order independent hash?
Dave Angel
d at davea.name
Thu Dec 1 10:52:46 EST 2011
More information about the Python-list mailing list
Thu Dec 1 10:52:46 EST 2011
- Previous message (by thread): order independent hash?
- Next message (by thread): order independent hash?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 12/01/2011 10:35 AM, 88888 Dihedral wrote: > On Wednesday, November 30, 2011 8:47:13 PM UTC+8, Peter Otten wrote: >> Neal Becker wrote: >> >>> I like to hash a list of words (actually, the command line args of my >>> program) in such a way that different words will create different hash, >>> but not sensitive to the order of the words. Any ideas? >> You mean a typical python hash value which would be /likely/ to differ for >> different lists and /guaranteed/ to be equal for equal lists is not good >> enough? Because that would be easy: >> >> args = sys.argv[1:] >> hash(tuple(sorted(args))) # consider duplicate args > I knew a hash can replace a bi-directional linked list. > The value can be a multi-field string to be parsed for further actions. > Is this what you are asking? A hash is a number, so I don't see how it can replace any kind of linked list. Perhaps you're thinking of some other language. -- DaveA
- Previous message (by thread): order independent hash?
- Next message (by thread): order independent hash?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list