how do you get the name of a dictionary?

jojoba jojoba12 at hotmail.com
Mon Aug 21 23:53:38 EDT 2006


Hello

Thanks Steven for laying out some interesting and compelling points.
I concede that my use of this would-be dictionary-name-asking is for
the most part useless (i am making a dictionary-editor-viewer in
python, and i would like to also be able to display the name of the
dictionary at the top of the data tree!)
Thank you for giving a pretty good reason why this inverse name-getting
(which is really not a true inverse, when none or many names exist) for
a dictionary has a poor cost benefit ratio.

However, regarding your comment about the phone book, I have a
question:
You say:

> If you know a person's name, you can look up their number in the phone
> book easily. If you know their phone number, it is much, much harder to
> look up their name -- unless you go to the time and effort of keeping a
> "reverse phone book".


By reverse phone book, do you mean something like listing all the
numbers in order, so as to optimize searching from phone number to
name...and the implicaiton being that for python, it is much faster to
find the data structure from the name, than the name from the data
structure?
If this is true, then you are quite right, and i am quite silly!
I guess i was just thinking that all else equal, searching for one side
(names) should be as fast as searching the other side (dictionaries),
and hence recovering the mappings of name(s) to dictionary is equally
fast both ways.
If this is not true, then certainly, you are correct in saying that
python need not spend its time managing a copious list of names and
dictionaries.
But does this really entail an overhaul of python to make such a thing
happen?
Thanks again for the insights,
very helpful
jojoba

o(-_-)o




More information about the Python-list mailing list