A class question

Donn Ingle donn.ingle at gmail.com
Sun Oct 28 11:01:57 CET 2007


Is there a way I can, for debugging, access the instance variable name from
within a class?
Class X: 
 def debug(self):
  print "My instance var is %s" % (some magic Python stuff)

So that:
>>>x = X()
>>>My Instance var is x

( Without passing the name in like: x=X(name="x") ) 


More information about the Python-list mailing list