Re: [Tutor] defaultdict(set)

2008-09-25 Thread Kent Johnson
On Thu, Sep 25, 2008 at 7:35 PM, Dinesh B Vadhia <[EMAIL PROTECTED]> wrote: > I'm using defaultdict(set) to store a dictionary d = {value : set_items} > where value = integer and set_items = set() of characters and it works > perfectly. > > I would like to also store the length of the set ie. l =

[Tutor] twill help

2008-09-25 Thread jeremiah
Any python twill users on here? When I login to a form login page through twill, my session vars and cookies are set correctly. however, when i do this through a python script (in attempt to automate the proccess) these same variables are not saved and I cannot login. Do I need to pass them some

Re: [Tutor] inheriting from a class

2008-09-25 Thread Alan Gauld
"Christopher Spears" <[EMAIL PROTECTED]> wrote class TransCircle(collisionObjects.Circle): def __init__(self): collisionObjects.Circle.__init__(self) self.image.set_colorkey((255, 255, 255)) Basically, he is creating a TransCircle class that inherits attributes from a Circle c

[Tutor] defaultdict(set)

2008-09-25 Thread Dinesh B Vadhia
I'm using defaultdict(set) to store a dictionary d = {value : set_items} where value = integer and set_items = set() of characters and it works perfectly. I would like to also store the length of the set ie. l = len(set_items) with the dictionary but don't how to do it using a defaultdict(). A

[Tutor] inheriting from a class

2008-09-25 Thread Christopher Spears
I'm working out of "Game Programming (The L Line)" by Andy Harris. He writes subclasses like so: class TransCircle(collisionObjects.Circle): def __init__(self): collisionObjects.Circle.__init__(self) self.image.set_colorkey((255, 255, 255)) Basically, he is creating a TransC

Re: [Tutor] Sorting Dictionary of Dictionary by certain Value

2008-09-25 Thread Joe
Thanks to Kent Johnson, Robert Berman, Bill Campbell and John Fouhy for the replies. They have been useful. Kent Johnson wrote: On Tue, Sep 23, 2008 at 8:41 PM, Joe Python <[EMAIL PROTECTED]> wrote: Hi Pythonistas, I have a large dictionary of dictionary (50,000+ keys) which has

Re: [Tutor] Current path (of program)

2008-09-25 Thread Adrian Greyling
Is it a faux pas to answer your own question?? I found this after I tweaked my search terms.. >From "Dive Into Python" ( http://diveintopython.org/functional_programming/finding_the_path.html) pathname = os.path.dirname(sys.

[Tutor] Current path (of program)

2008-09-25 Thread Adrian Greyling
I've been using "os.getcwd()" to get my program's "current path". I know it's actually returning my "current working directory", but it's been working okay, until today... I used py2exe (and InnoSetup) to create a standalone executable (for Windows) and then a shortcut icon on the desktop to "MyP

Re: [Tutor] How to replace instances

2008-09-25 Thread Kent Johnson
On Thu, Sep 25, 2008 at 8:03 AM, Steve Collins <[EMAIL PROTECTED]> wrote: > that's what I was trying (incorrectly) to achieve the above example. > but how can I do this for an arbitrary number of objects in a list? > > I have a list x = [a,b,c] and a list y = [d,e,f], both filled with > instance o

Re: [Tutor] How to replace instances

2008-09-25 Thread Steve Collins
On 9/25/08, Kent Johnson <[EMAIL PROTECTED]> wrote: > On Thu, Sep 25, 2008 at 4:24 AM, Steve Collins <[EMAIL PROTECTED]> > wrote: > >> However, some of the instances refer explicitly to other instances >> instances. It's obvious why this causes problems. It occurred to me to >> simply replace the i

Re: [Tutor] How to replace instances

2008-09-25 Thread Kent Johnson
On Thu, Sep 25, 2008 at 4:24 AM, Steve Collins <[EMAIL PROTECTED]> wrote: > However, some of the instances refer explicitly to other instances > instances. It's obvious why this causes problems. It occurred to me to > simply replace the instances with the ones in the un-pickled list, but I > don't

Re: [Tutor] user agent

2008-09-25 Thread Alan Gauld
"Kent Johnson" <[EMAIL PROTECTED]> wrote Alan, I think you might have this backwards. I think jeremiah wants to specify the user agent on the client side of the connection. Ah! In that case it makes sense. Ignore my ramblings :-) Alan G ___

[Tutor] How to replace instances

2008-09-25 Thread Steve Collins
I've written a save/load function for a simple program using cPickle. Upon saving, a master list, to which all instances are added in their __init__, is pickled. when the program starts, if the user wishes to load, a variable "load" is set to one, and the pickled list is loaded. All the classes eit