Instance names for classes
Greg Ewing (using news.cis.dfn.de)
g2h5dqi002 at sneakemail.com
Thu May 22 22:38:31 EDT 2003
Tony Clarke wrote:
> how can I get a class instance, e g a= b() to return its name, a?
The question is not meaningful -- "a" is not "its name", it's
just *a* name that happens for the time being to refer to
the instance.
If you need your objects to have names, you should explicitly
give them names, e.g.
a = b()
a.name = "fred"
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list