NEWBIE: What's the instance name?

Michael Hudson mwh at python.net
Mon Dec 29 15:02:21 CET 2003


engsolnom at ipns.com writes:

> What I'd like to do is display is the instance name. Is it hiding
> somewhere?

>From http://www.amk.ca/quotations/python-quotes/page-8.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, in answer to the question "How can I
      get the name of a variable from C++ when I have the PyObject*?"

One of my favourite Python quotes...

Cheers,
mwh


-- 
  THEOS: Mad cow. Utterly fucking insane cow, in fact. A cow so
  mad it thinks it's a tetapot. The swamp dragon of the OS world.
                           -- Jim's pedigree of operating systems, asr




More information about the Python-list mailing list