getting an object name

Simon Brunning simon.brunning at gmail.com
Wed Jun 22 04:00:23 EDT 2005


On 6/22/05, David Bear <David.Bear at asu.edu> wrote:
> Let's say I have a list called, alist. If I pass alist to a function,
> how can I get the name of it?

The effbot put it beautifully:

"The same way as you get the name of that cat you found on your porch:
the cat (object) itself cannot tell you its name, and it doesn't
really care -- so the only way to find out what it's called is to ask
all your neighbours (namespaces) if it's their cat (object) ... and
don't be surprised if you'll find that it's known by many names, or no
name at all!"

-- 
Cheers,
Simon B,
simon at brunningonline.net,
http://www.brunningonline.net/simon/blog/



More information about the Python-list mailing list