Classes & Instances
Mark McEahern
marklists at mceahern.com
Wed Jan 2 14:35:29 EST 2002
original post essentially asked:
how do I get an instance's name?
pseudocode:
class A:
def instanceName(self):pass
f = a()
print f.instanceName # should print "f"
a tangential suggestion might be to look into implementing one of the
creational patterns from GoF in Python to control the creation of class
instances, thereby allowing you to keep track of them.
// mark
More information about the Python-list
mailing list