Yeah hash(hash(immutable))=hash(immutable) it seems. Not sure this is a specification but it happens that way: ------------------------------------------ $ >>> hash('abc') -1600925533 $ >>> hash(hash('abc')) -1600925533 $ >>> hash(hash(hash(('abc')))) -1600925533 >>> ----------------------------------------- Of course then hash(0)=0, hash(1)=0 and also hash(2**32)=1, all this in standard CPython on IA32.
Nick Vatamaniuc Ganesan Rajagopal wrote: > >>>>> "Terry" == Terry Hancock <[EMAIL PROTECTED]> writes: > > > Note that it is trivial to catch collisions on entry and correct them: > > > key = hash(url_string) > > i = 0 > > if d.has_key(key): > > while d.has_key(key): > > i += 1 > > hash is a number. It's sufficient to do > > while d.has_key(key): > key += 1 > > > I am a little surprised that hash(hash(s)) == hash(s), is that actually > > true? > > >>> hash(42) > 42 > > Ganesan > > -- > Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list