Why is lambda allowed as a key in a dict?
rt8396 at gmail.com
Wed Mar 11 22:54:25 CET 2009
On Mar 11, 4:32 pm, Terry Reedy <tjre... at udel.edu> wrote:
> Similarly, if one is populating a LARGE structure with duplicate values,
> it may be worthwhile to cache values that are not cached by the interpreter.
Actually i had no idea how Python handled strings(immutables)
internally but after considering this for 1 second it makes complete
sense. I have never compared two "like" strings to see what the
outcome will be because i never needed to. Just like i never used a
lambda as a dict key and probably never will. But these things are
good to know.
When i learn something new (like Python) i tend to jump right in and
learn by trial and error -- sometimes it feels more like trial by fire
-- that is how i have learned the Python language. I still have not
read Guido's tutorial from front to back (not proud of that BTW),
actually i haven't read but maybe 10% of it!
I think now would be a good time to read the entire tut from my
"field" experienced level and fill in all the (maybe mostly
insignificant (but very important)) details of how python handles data
internally. This should give me a much better insight of the language
and will most defiantly improve my code writing skills.
Sorry Graig for my misinterpretation of your post. And thanks Terry
for the great explanation.
More information about the Python-list