On Wed, Aug 12, 2009 at 1:37 PM, James Stroud<jstr...@mbi.ucla.edu> wrote: > Steven D'Aprano wrote: >> >> Well there you go -- why on earth would you prohibit None as a dictionary >> key??? That's a serious failure. > > > roentgen 1% python > Python 2.5 (r25:51908, Sep 20 2006, 17:36:21) [GCC 3.4.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > py> hash(None) > 135543872 > > > mbi136-176 98% /usr/bin/python > Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12) [GCC 4.0.1 (Apple Inc. > build 5465)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > py> hash(None) > 2030240
Actually, None is a special-case as a built-in singleton value -- there's only ever *exactly one* instance of it in a given interpreter session. And I'm reasonably sure dict pickles don't store the hash code of items (the dict gets recreated from scratch), so there's no problem. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list