[Tutor] Accessing the name of and instance variable

Edward Comber comber at cix.co.uk
Sat Nov 15 07:18:56 EST 2003


for debugging purposes, I would like to be able to print the name of some
instances of classes directly from the program, together with the class
data. the data is of course simple but getting the name is a problem to me.

The best I have come up with so far is vars(), from which I can scan for
instances of the relevant classes.

However the name of the instance is returned as a string. How would I get my
hands on the actual instance from this in order to get at its instance so as
to print teh data? Or is ther a better way of going about what I need to do?

Thanks,
Eddie.




More information about the Tutor mailing list