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


Groups > comp.lang.python > #16430

Re: order independent hash?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <mail@timgolden.me.uk>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'args': 0.05; 'from:addr:timgolden.me.uk': 0.09; 'from:name:tim golden': 0.09; 'message-id:@timgolden.me.uk': 0.09; 'ideas?': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'subject:independent': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'cc:no real name:2**0': 0.20; 'header:In-Reply- To:1': 0.22; 'cc:2**0': 0.24; 'command': 0.24; 'cc:addr:python.org': 0.29; 'hash': 0.30; 'tjg': 0.30; 'subject:?': 0.31; 'list': 0.32; 'header:User-Agent:1': 0.33; 'but': 0.37; 'received:192': 0.37; 'received:192.168': 0.40; 'order': 0.62; 'from:addr:mail': 0.64; 'about?': 0.84; 'to:none': 0.93
Date Wed, 30 Nov 2011 12:38:14 +0000
From Tim Golden <mail@timgolden.me.uk>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version 1.0
CC python-list@python.org
Subject Re: order independent hash?
References <jb57p7$b1j$1@dough.gmane.org>
In-Reply-To <jb57p7$b1j$1@dough.gmane.org>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3155.1322656704.27778.python-list@python.org> (permalink)
Lines 10
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1322656704 news.xs4all.nl 6862 [2001:888:2000:d::a6]:59472
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16430

Show key headers only | 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