Printing the name of a variable

Stephen Boulet stephen.boulet at gmail.com
Thu Sep 9 21:43:43 CEST 2010


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.



More information about the Python-list mailing list