hash()

jepler at unpythonic.net jepler at unpythonic.net
Mon Dec 5 21:28:50 EST 2005


> [John Marshall]
> > For strings of > 1 character, what are the chances
> > that hash(st) and hash(st[::-1]) would return the
> > same value?
> 
On Mon, Dec 05, 2005 at 09:11:14PM -0500, Tim Peters wrote:
> First, if `st` is a string, `st[::-1]` is a list.  Do you really mean
> to compare string hashes with list hashes here?  I'm going to assume
> not.

It is?

>>> st = "french frogs"
>>> st[::-1]
'sgorf hcnerf'

(Python 2.3)

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20051205/37eca1eb/attachment.sig>


More information about the Python-list mailing list