Re: pretty basic instantiation question

2006-10-24 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Why do you need to know the number of instances. I know that Python > does not support Class Variable, Plain wrong. class Class(object): classvar = ["w", "t", "f"] print Class.classvar c = Class() c.classvar.append("???") print c.classvar -- bruno desthuilliers p

Re: pretty basic instantiation question

2006-10-23 Thread Steven D'Aprano
On Mon, 23 Oct 2006 17:36:14 -0700, meithamj wrote: [fixing top-posting] > [EMAIL PROTECTED] wrote: >> i'm very new to python, but i have a pretty basic question: >> let's say i have a class, and i need to create a different number of >> instances (changes every time - and i can't know the number

Re: pretty basic instantiation question

2006-10-23 Thread meithamj
Why do you need to know the number of instances. I know that Python does not support Class Variable, but you can always create a global variable and increase it whenever you add a new instance. this will keep a record for you of how many instances you have. [EMAIL PROTECTED] wrote: > i'm very new

Re: pretty basic instantiation question

2006-10-23 Thread Steve Holden
Leif K-Brooks wrote: > [EMAIL PROTECTED] wrote: > >>let's say i have a class, and i need to create a different number of >>instances (changes every time - and i can't know the number in advance) in >>a loop. >>a function receives the number of instances that are needed, and creates >>them like, >>

Re: pretty basic instantiation question

2006-10-23 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > let's say i have a class, and i need to create a different number of > instances (changes every time - and i can't know the number in advance) in > a loop. > a function receives the number of instances that are needed, and creates > them like, > a=Myclass() > b=Myclass()