Printing the name of a variable

Mel mwilson at the-wire.com
Thu Sep 9 23:10:54 EDT 2010


Stephen Boulet wrote:

> Does an arbitrary variable carry an attribute describing the text in
> its name? I'm looking for something along the lines of:
> 
> x = 10
> print x.name
>>>> 'x'
> 
> Perhaps the x.__getattribute__ method? Thanks.

Hmm.  "Recent scholarship suggests that the Iliad and the Odyssey may not 
have been written by Homer, but by someone else with the same name."

	Mel.




More information about the Python-list mailing list