Printable string for 'self'
nospamformeSVP at gmail.com
Wed Mar 15 21:16:25 CET 2006
Fredrik Lundh wrote:
> Q. How can my code discover the name of an object?
> A. The same way as you get the name of that cat you found on your
> porch: the cat 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 if it's their cat... and don't be surprised if you'll find that
> it's known by many names, or no name at all!
> (fwiw, the current crop of stray cats in my neighbourhood are known
> as "sune" and "the big fat red one")
"This is a project on which we have been working for the last three
centuries since the lamasery was founded, in fact. It is somewhat alien
to your way of thought, so I hope you will listen with an open mind
while I explain it."
"It is really quite simple. We have been compiling a list which shall
contain all the possible names of God."
From "The Nine Billion Names of God" by Arthur C. Clarke.
> no, as long as you're aware that you're doing introspection, and that your
> code won't run in all Python environments.
Yes, it is introspection for a testing tool - not for production code.
More information about the Python-list