how do you get the name of a dictionary?

jojoba jojoba12 at hotmail.com
Tue Aug 22 17:14:28 EDT 2006


> 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 must be driving python purists to their limits...but

I'm not sure how to dynamically pass the name of the dictionary without
hard coding it.

> 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.

But this is 2006, and my computer can do 50 googlillion computations a
second.
So what does attaching or removing a title matter to my computer. What
searching has to happen?  I know where the dictionary reference points,
so i have immediate accesss to that data structure, don't I?  Please
excuse me if i am way oversimplifying.
Also, i am sure there are many computations going on in any python
program, that technically, might not be needed for that program per se,
but that doesn't invalidate those computations' presence in general.

 > 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.

Good question. Indeed I am not limiting this to dicitonaries, as other
data types, lists, tuples, etc. could use this as well.


jojoba




More information about the Python-list mailing list