order independent hash?

Tim Golden mail at timgolden.me.uk
Wed Nov 30 07:38:14 EST 2011


On 30/11/2011 12:32, 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?

How about?

   hash (frozenset ("hello world".split ()))

TJG



More information about the Python-list mailing list