names
Michael Hudson
mwh21 at cam.ac.uk
Mon Jan 15 05:31:34 EST 2001
"Elliott Chapin" <echapin at sympatico.ca> writes:
> How can I get the name of an object as a string? As a biginner I might
> imagine something like
>
> >>>b=[[1],[2]]
> >>>name(b)
> 'b'
>From http://www.amk.ca/quotations/python-quotes.html:
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!
Fredrik Lundh, 3 Nov 2000
one of many quotes that should really be memorised by everyone
associated with Python....
Cheers,
M.
--
And then the character-only displays went away (leading to
increasingly silly graphical effects and finally to ads on
web pages). -- John W. Baxter, comp.lang.python
More information about the Python-list
mailing list