Hello all,
I am going through a link about generators that someone posted. In the beginning he compares the two functions below. On his setup he showed a speed increase of 5% with the generator.
I'm running windows XP, python 3.1.1, and cannot seem to duplicate the results. I keep showing the "old way"(logs1) as being slightly faster ...
I have a wxPython application I'm bundling into an exe using py2exe. I've defined an icon in the setup.py file using the following:
setup(
windows=[
{
'script': 'myapp.py',
'icon_resources': [(1, 'myicon.ico')]
},
],
)
This works, but I'd like to be able to access that icon from my wxPy...
This piece of code gives a syntax error at the colon of "elif process.loop(i, len(list_i) != 'repeat':" and I can't seem to figure out why.
class process:
def loop(v1, v2):
if v1 < v2 - 1:
return 'repeat'
def isel(chr_i, list_i):
for i in range(len(list_i)):
if chr_i == list_i[i]:
...
Right now I am going through MIT's introduction to Computer Science course via OpenCourseWare. As a part of this course I am learning the Python Language.
I've read a lot of things about the benefits of learning C. Before I dig any deeper into Python I wonder if I will be hindered or helped by learning Python first.
Do you think that I...
hello,
I am building a mozilla extension that contacts a python application on a remote server to send and receive data. The python application can be used using xml-rpc from a python console.I am given the task to design a json-rpc that would contact the same application.Making the python server side has been easy which can be accesed u...
Say I have a simple table that contains username, firstname, lastname.
How do I express this in berkeley Db?
I'm currently using bsddb as the interface.
Cheers.
...
Is there a way to create a 'kiosk mode' in wxpython under Windows (98 - 7) where the application disables you from breaking out of the app using Windows keys, alt-tab, alt-f4, and ctrl+alt+delete?
...
My doubt is that if the len(list) calculates the length of the list everytime it is called or it returns the value of the builtin counter.I have a context where i need to check the length of list everytime in a loop, likelistData = []
for value in ioread():
if len(listData)>=25:
processlistdata()
clearlistdata()
l...
Hi everyone
I would like to do the following:
1) Serialize my class
2) Also manually edit the serialization dump file to remove certain objects of my class which I find unnecessary.
I am currently using python with simplejson. As you know, simplejson converts all characters to unicde. As a result, when I dump a particular object with s...
I noticed that this recipe seems to use __rlshift__, __ror__ like operators. But, they aren't in the documentation! Can anyone explain these and perhaps point to some docs?
...
This piece of code is supposed to go through a list and preform some formatting to the items, such as removing quotations, and then saving it to another list.
class process:
def rchr(string_i, asciivalue):
string_o = ()
for i in range(len(string_i)):
if ord(string_i[i]) != asciivalue:
stri...
I need to code a program with GUI in python (I'm thinking of using TKinter, 'cause it's easy, but I'm open to suggestions).
My major problem is that I don't know how to code a timer (like a clock... like 00:00:00,00 hh:mm:ss,00 ) I need it to update it self (that's what I don't know how to do)
...
With python inotifyx, do I have to remove watch and close opened system file descriptor if I need them until program exit? E.g. is there some possible problems if I create one (file descriptor + watch) with each run and don't close it?
...
How do I put a program in the system tray (I don't think it's called like that in Linux) in python TKINTER for UBUNTU 9.04.
...
cursor.execute("SELECT SQL_CALC_FOUND_ROWS user_id FROM...limit 5")
rows = cursor.fetchall()
...
total_rows = cursor.execute("SELECT FOUND_ROWS()") #this doesn't work for some reason.
Edit: I tried SELECT FOUND_ROWS() FROM my_table...and the numbers are funky.
...
Consider..
dict = {
'Спорт':'Досуг',
'russianA':'englishA'
}
s = 'Спорт russianA'
I'd like to replace all dict keys with their respective dict values in s.
...
I'm trying to validate a form containing a ModelChoiceField:
forms.py:
from django import forms
from modelchoicetest.models import SomeObject
class SomeObjectAddForm(forms.ModelForm):
class Meta:
model = SomeObject
models.py:
from django.db import models
class SomeChoice(models.Model):
name = models.CharField(max_...
I tried to implement __concat__, but it didn't work
>>> class lHolder():
... def __init__(self,l):
... self.l=l
... def __concat__(self, l2):
... return self.l+l2
... def __iter__(self):
... return self.l.__iter__()
...
>>> lHolder([1])+[2]
Traceback (most recent call last):
File "<stdi...
I'm Delphi developer, and I would like to build few web applications, I know about Intraweb, but I think it's not a real tool for web development, maybe for just intranet applications
so I'm considering PHP, Python or ruby, I prefer python because it's better syntax than other( I feel it closer to Delphi), also I want to deploy the appl...
I love the IDLE. However, sometimes I have 100-200 line scripts and I want to sort of interactively debug/play with say, functions defined in foo.py instead of just calling python foo.py. Is there a way I can trigger IDLE in the context of my foo.py?
...