Why is lambda allowed as a key in a dict?
Wed Mar 11 00:39:06 CET 2009
Craig Allen <callen314 at gmail.com> writes:
> it raises an interesting question about why doesn't it. I can think
> of practical answers to that, obviously, but in principle, if a
> function compiles to exactly the same byte code, you obviously do not
> need two copies of it, and like strings shouldn't an identical
> function have the same id?
Identical strings don't necessarily have the same id:
>>> a = "a"*1000
>>> b = "a"*1000
More information about the Python-list