Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16430

Re: order independent hash?

Date 2011-11-30 12:38 +0000
From Tim Golden <mail@timgolden.me.uk>
Subject Re: order independent hash?
References <jb57p7$b1j$1@dough.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.3155.1322656704.27778.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: order independent hash? Tim Golden <mail@timgolden.me.uk> - 2011-11-30 12:38 +0000

csiph-web