By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,517 Members | 1,752 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,517 IT Pros & Developers. It's quick & easy.

Extracting name strings from assigned objects

P: n/a
I would like to ask how one might obtain the assigned name of an
assigned object as a string. I would like to use object names as an
algorithmic input.
To demonstrate... So if i have:
>>foo = {}
what can I do to the object 'foo' so as to return the string 'foo'?

Thanks!
Oct 28 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
2008/10/28 Shannon Mayne <sh******@gmail.com>:
I would like to ask how one might obtain the assigned name of an
assigned object as a string.
That's in the FAQ: <http://tinyurl.com/3xkeac>.

--
Cheers,
Simon B.
si***@brunningonline.net
Oct 28 '08 #2

P: n/a
On Tue, 28 Oct 2008 09:23:46 -0700, Shannon Mayne wrote:
I would like to ask how one might obtain the assigned name of an
assigned object as a string. I would like to use object names as an
algorithmic input.
To demonstrate... So if i have:
>>>foo = {}

what can I do to the object 'foo' so as to return the string 'foo'?
There's a lot of confusion there. The object 'foo' is a string, and it
doesn't occur anywhere in your code. The name foo is not an object, it is
a name. Perhaps you meant the object {} (an empty dict)?

The object {} doesn't know what names (note plural) it has been bound
too. It could be bound to one name:

foo = {}

or many names:

foo = bar = baz = flib = {}

or no names at all:

{}
Names are not properties of objects. You can't do what you are trying to
do. If you tell us why you want to do this, perhaps we can suggest a way
to do it.

--
Steven
Oct 28 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.