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

ShanMayne shangach at gmail.com
Wed Oct 29 09:31:20 EDT 2008


> The simplest and best option here is to store the objects in a
> dictionary with their keys being the generated names.

Thanks. Indeed Alex, that may well be the simplest way, to have an
overarching Dictionary of references/names and objects.

However this does not help me to use the reference/name of an object I
imported instead of created.

#-----#

There has been much debate over terminology but I was under the
impression that there was a simple input-output defined task in
question.

Inherently a the variable/name/reference maps to the object it was
assigned to. The question is can one map it the other way? If there
are multiple assignments to the same object can they be listed? This
applies to the "names" object atributes as well.

Joe has mentioned that I shouldn't need to do this and should perhaps
rethink my problem formulation. Nonetheless, I would still like to
know how it might be done.

Thanks
Shannon




More information about the Python-list mailing list