hash()
Tim Peters
tim.peters at gmail.com
Mon Dec 5 21:44:23 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?
[Tim Peters]
>> 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.
[Jeff Epler]
> It is?
>
> >>> st = "french frogs"
> >>> st[::-1]
> 'sgorf hcnerf'
>
> (Python 2.3)
Indeed that's right. Python 2.4+ also. My apologies! Good thing it
doesn't matter to the rest of the exposition ;-)
More information about the Python-list
mailing list