How can I get the name of an object???

Remco Gerlich scarblac-spamtrap at
Thu Apr 27 17:07:55 CEST 2000

spex66 at wrote in comp.lang.python:
> In article <etd8zy03m44.fsf at>,
>   Alex <cut_me_out at> wrote:
> >
> > An object could be referred to by any number of names:
> >
> > dd = zz ()
> > ee = dd
> >
> > Which name for the object do you wish to know?  ee or dd?
> dd or in other words, the name of the FIRST made instance...

What would happen in the following cases:
  dd = zz()
  ee = dd
  del dd
  print ee.__name__
  dd = [xx(), yy(), zz()]
  print dd[2].__name__
  print zz().__name__

Classes have a name (the one used in their class: statement). 
Instances have no name, period.

But why would you need it? In most cases where people try to use something
like this, dictionaries are a solution.

Remco Gerlich,  scarblac at
"This gubblick contains many nonsklarkish English flutzpahs, but the
 overall pluggandisp can be glorked from context"  (David Moser)

More information about the Python-list mailing list