How to get an object's name as a string?

Joe Strout joe at
Wed Oct 29 02:05:33 CET 2008

On Oct 28, 2008, at 6:58 PM, Steve Holden wrote:

> Objects in Python *don't* have names. Period. In Python we don't
> normally talk about variables anyway, except when speaking loosely, we
> talk about binding names. But please don't let this start another  
> round
> of "Python programmers don't know how to describe the language". You
> have already made your opinions on that score more than clear.

As have I, I suppose, and I'll try to quit engaging in that argument  
in the future.

> l = []
> l.append(l)
> del l
> What's the name of the list formerly known as "l"?

Hey, that's a very nice little demonstration of an orphaned object.   
Thanks for sharing it!

- Joe

More information about the Python-list mailing list