how do you get the name of a dictionary?

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Tue Aug 22 16:05:59 EDT 2006


In <1156268752.574983.123520 at 75g2000cwc.googlegroups.com>, jojoba wrote:

> Aha.....
> my problem, (which as i said before, is not really an important
> problem) is to take any dictionary and load it into a tree viewer AND
> get the name(s) of that dictionary (if they exist, and if not, so be
> it).

How do you take "any" dictionary?  Don't you have to know a name to refer
to it?  Just pass this very name as additional argument to your tree
viewer.

> I know i am harping on this, but no one of yet has really proven why
> having such a feature would seriously affect python speed.
> Any ideas?

You have to attach a name to a dict every time it's assigned to a name and
delete a name from the dictionary every time such a name is deleted or
rebound to some other object.  And all this is unnecessary extra work and
memory consumption in 99.99% of most programs.

And why do you want to special case dictionaries?  If Python is doing it
for dictionaries, sooner or later someone will ask for the names of lists
or any arbitrary object.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list