Reset static variables or a workaround

2012-02-23 Thread Nav
nstance. I understand this is because first_name is static in nature. But I would like to reset the first_name for every instance? How can I do this? Regards, Nav -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
"> if yes then: > if using globalnamespace is bad then why does every book or tutorial > about python classes give the above style of assignment as an > example? That's a basic assignment example. It's not a direct manipulation of globals(), like the solution given by Jan, which you seem to fee

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
Thanks for pointing it out Steve. The blog post doesn't explain it very well. I understand the risk of exec or eval(input). but what are the risks of globalnamespace use and what are the benefits? -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
Okay, let me ask another question: When we create instances of objects by doing x = className () are we using globalnamespace? if yes then: if using globalnamespace is bad then why does every book or tutorial about python classes give the above style of assignment as an example? Second why do

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
Thanks Jan, You read my mind. That is exactly what I needed. Thanks for showing the product function from itertools as well. It seems easier to grasp than the nested loops, I had been using. I noticed chopin.edu.pl. Are you a musician? Nav -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
On Jan 4, 4:54 pm, Chris Rebert wrote: > On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik wrote: > > You could put them in a dictionary with the key being the name, instead of > > a list. > > To illustrate that for the OP: > > name2drink = {} > for booze in liquors: >     for juice in juices: >  

Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
I have a class of let's say empty bottle which can have a mix of two items. I want to create let's say 30 of these objects which will have names based on the 2 attributes (apple juice, beer, grape juice, beer, etc) that I provide from a list. All the objects are a mix of (1 of three alcohols) and (