Classes & Instances

Andrew Nguyen pythonnet at hotmail.com
Wed Jan 2 14:00:27 EST 2002


We all know that you can't use classes without instances. 

Now, for the problem. How do I get a class, so that when an instance
is made of it, the class records the instance's name to a list.

e.g, 
class a:
     pass

f = a

----

how do I get f into a list. And remember, my goal is _flexability_ so:

class a:
     pass

f = a

foolist = ['f']

Will NOT work for my goal, but, if let's say there is a function,
'TakeInstanceName()':

class a:
     foolist[:-1]=TakeInstanceName()#This function takes the Instance
name      #  whenever the class is refered to

f = a

#Now after that, foolist should have ['f'], but, my question is, what
IS the #function that would take the TakeInstanceName()'s place?
-----



More information about the Python-list mailing list