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


Groups > comp.lang.python > #16606

Re: order independent hash?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.04; 'function,': 0.07; 'indeed,': 0.07; 'type,': 0.07; 'python': 0.08; 'deletion': 0.09; 'etc).': 0.09; 'historic': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'size)': 0.09; 'specified,': 0.09; '"python': 0.15; 'tries': 0.15; '(key,': 0.16; 'dictionary:': 0.16; 'instance;': 0.16; 'lifted': 0.16; 'sha,': 0.16; 'specified.': 0.16; 'subject:independent': 0.16; 'transmit': 0.16; 'uncompressed': 0.16; 'wrote:': 0.18; '>>>': 0.18; 'functions,': 0.18; 'insert': 0.19; 'memory': 0.21; 'mechanism': 0.21; 'result.': 0.21; 'input': 0.22; 'dec': 0.22; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; '(usually': 0.23; 'archiving': 0.23; 'dictionary': 0.23; 'english,': 0.23; 'pair': 0.23; 'referring': 0.23; 'defined': 0.24; 'string': 0.24; 'library.': 0.24; 'function': 0.27; 'putting': 0.28; 'fixed': 0.29; 'pm,': 0.29; 'calculated': 0.30; 'hash': 0.30; 'signatures': 0.30; 'value)': 0.30; 'chris': 0.30; 'specified': 0.31; 'usually': 0.31; 'subject:?': 0.31; 'pretty': 0.32; "isn't": 0.33; 'header :User-Agent:1': 0.33; 'header:X-Complaints-To:1': 0.33; 'object': 0.33; 'fri,': 0.34; 'done': 0.34; 'to:addr:python-list': 0.34; 'normally': 0.34; 'too': 0.34; 'all.': 0.34; 'algorithms': 0.34; 'function.': 0.34; 'stores': 0.34; 'typical': 0.34; 'operations': 0.35; 'similar': 0.36; 'beginning': 0.36; 'properties': 0.36; 'received:au': 0.36; 'uses': 0.36; 'friday,': 0.37; 'but': 0.37; 'run': 0.37; 'think': 0.37; 'could': 0.37; 'somewhat': 0.38; 'steven': 0.38; 'received:org': 0.38; 'aside': 0.39; 'programming.': 0.39; 'tables': 0.39; 'clearly': 0.39; "couldn't": 0.39; 'called': 0.40; "it's": 0.40; 'to:addr:python.org': 0.40; 'management': 0.60; 'type': 0.61; '2011': 0.61; 'your': 0.61; 'happen': 0.61; 'grow': 0.62; 'auto': 0.63; 'true;': 0.67; 'protection': 0.67; 'collection': 0.69; 'concept': 0.74; 'verification': 0.78; 'inquiring': 0.84; 'cryptography': 0.93; 'received:110': 0.95
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Lie Ryan <lie.1296@gmail.com>
Subject Re: order independent hash?
Date Mon, 05 Dec 2011 00:40:20 +1100
References <jb57p7$b1j$1@dough.gmane.org> <mailman.3156.1322657239.27778.python-list@python.org> <30715729.411.1322753732534.JavaMail.geo-discussion-forums@pret21> <4ED7A2CE.6070306@davea.name> <mailman.3203.1322756312.27778.python-list@python.org> <6366868.86.1322800180523.JavaMail.geo-discussion-forums@pret21> <mailman.3216.1322802013.27778.python-list@python.org> <1576053.251.1322804908048.JavaMail.geo-discussion-forums@pruu5>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 110-175-240-90.static.tpgi.com.au
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0
In-Reply-To <1576053.251.1322804908048.JavaMail.geo-discussion-forums@pruu5>
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.3263.1323006037.27778.python-list@python.org> (permalink)
Lines 74
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1323006037 news.xs4all.nl 6873 [2001:888:2000:d::a6]:33216
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16606

Show key headers only | View raw


On 12/02/2011 04:48 PM, 88888 Dihedral wrote:
> On Friday, December 2, 2011 1:00:10 PM UTC+8, Chris Angelico wrote:
>> On Fri, Dec 2, 2011 at 3:29 PM, 88888 Dihedral
>> <dihedr...@googlemail.com>  wrote:
>>> I clear my point a hash is a collection of (key, value) pairs that have
>>> well defined methods and behavior to be used in programming.
>>>
>>> The basic operations of a hash normally includes the following:
>>>
>>> 1. insertion of a (key, value) pair  into the hash
>>> 2. deletion of a (key, value) from the hash
>>> 3. inquiring  a hash by a key to retrieve the value if the (key, value)
>>> pair available in the hash. If no key matched, the hash will return
>>> a not found result.
>>>
>>> The hash can grow with (k,v) pairs accumulated in the run time.
>>> An auto memory management mechanism is required for a hash of a non-fixed size of (k,v) pairs.
>>
>> That's a hash table - think of a Python dictionary:
>>
>> On Fri, Dec 2, 2011 at 3:33 PM, Steven D'Aprano
>> <steve+comp....@pearwood.info>  wrote:
>>> Python dicts are hash tables.
>>
>> Although strictly speaking, isn't that "Python dicts are implemented
>> as hash tables in CPython"? Or is the hashtable implementation
>> mandated? Anyway, near enough.
>>
>
>
>> Cryptography and data verification use hashing too (look at the
>> various historic hashing algorithms - CRC, MD5, SHA, etc). The concept
>> of a hash is a number (usually of a fixed size) that is calculated
>> from a string or other large data type, such that hashing the same
>> input will always give the same output, but hashing different input
>> will usually give different output. It's then possible to identify a
>> large object solely by its hash, as is done in git, for instance; or
>> to transmit both the data and the hash, as is done in message
>> protection schemes (many archiving programs/formats include a hash of
>> the uncompressed data). These have nothing to do with (key,value)
>> pairs, but are important uses of hashes.
>>
>> ChrisA
>
> If one tries to insert a (k,v1) and then a (k,v2) pair into a
> hash with v1 not equals V2, what could happen in your understanding of
> a hash?

Don't try to argue, in English, `hash != hash` is true; it's just a 
typical occurence of homonyms. Just because they have the same name 
doesn't mean hash (function) has to have somewhat similar properties to 
hash (table).

> A hash function is different from a hash or so called a hash table in
> my post.

Indeed.

> If the hash collision rate is not specified, then  it is  trivial to write a hash function with the conditions you specified. A hash function applied to a set of data items only  is of very limited use at all.

It's trivial indeed, but a hashtable couldn't exist without hash 
function. And without a good hash function, a hash table's performance 
may degrade into O(n) access/insertion/deletion.

> A hash stores (k,v) pairs specified in the run time with auto memory
> management build in is not a simple hash function to produce data signatures only clearly in my post.
>
> What I said a hash which is lifted as a basic type in python  is called a dictionary in python.
>
> It is called a map in c++'s generics library.

Putting aside all these, it's pretty obvious from the beginning that OP 
was referring to hash functions, not hash tables.

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


Thread

Re: order independent hash? Peter Otten <__peter__@web.de> - 2011-11-30 13:47 +0100
  Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-01 07:35 -0800
  Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-01 07:35 -0800
    Re: order independent hash? Dave Angel <d@davea.name> - 2011-12-01 10:52 -0500
      Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-01 08:17 -0800
      Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-01 08:17 -0800
    Re: order independent hash? Chris Angelico <rosuav@gmail.com> - 2011-12-02 03:18 +1100
      Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-01 20:29 -0800
        Re: order independent hash? Chris Angelico <rosuav@gmail.com> - 2011-12-02 16:00 +1100
          Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-01 21:48 -0800
            Re: order independent hash? Lie Ryan <lie.1296@gmail.com> - 2011-12-05 00:40 +1100
          Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-01 21:48 -0800
            Re: order independent hash? Roel Schroeven <rschroev_nospam_ml@fastmail.fm> - 2011-12-04 14:41 +0100
              Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-04 07:39 -0800
                Re: order independent hash? Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-04 10:41 -0700
                Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-04 10:06 -0800
                Re: order independent hash? Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-04 13:13 -0700
                Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-04 15:17 -0800
                Re: order independent hash? Matt Joiner <anacrolix@gmail.com> - 2011-12-05 10:21 +1100
                Re: order independent hash? Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-04 16:24 -0700
                Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-04 16:52 -0800
                Re: order independent hash? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-05 02:00 +0000
                Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-04 16:52 -0800
                Re: order independent hash? Lie Ryan <lie.1296@gmail.com> - 2011-12-05 12:59 +1100
                Re: order independent hash? Ethan Furman <ethan@stoneleaf.us> - 2011-12-04 18:08 -0800
                Re: order independent hash? Ben Finney <ben+python@benfinney.id.au> - 2011-12-05 15:52 +1100
                Re: order independent hash? Matt Joiner <anacrolix@gmail.com> - 2011-12-05 14:02 +1100
                Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-06 21:24 -0800
                Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-06 21:24 -0800
                Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-04 15:17 -0800
                Re: order independent hash? Terry Reedy <tjreedy@udel.edu> - 2011-12-04 19:28 -0500
                Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-04 10:06 -0800
          Re: order independent hash? Hrvoje Niksic <hniksic@xemacs.org> - 2011-12-02 10:53 +0100
            Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-02 03:48 -0800
            Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-02 09:00 -0800
            Re: order independent hash? Terry Reedy <tjreedy@udel.edu> - 2011-12-02 16:40 -0500
              Re: order independent hash? Hrvoje Niksic <hniksic@xemacs.org> - 2011-12-04 14:55 +0100
                Re: order independent hash? Chris Angelico <rosuav@gmail.com> - 2011-12-05 01:08 +1100
                Re: order independent hash? Hrvoje Niksic <hniksic@xemacs.org> - 2011-12-07 14:28 +0100
                Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-07 09:48 -0800
                Re: order independent hash? Tim Chase <python.list@tim.thechases.com> - 2011-12-04 12:57 -0600
                Re: order independent hash? Hrvoje Niksic <hniksic@xemacs.org> - 2011-12-08 10:30 +0100
                Re: order independent hash? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-09 11:27 +0000
                Re: order independent hash? Hrvoje Niksic <hniksic@xemacs.org> - 2011-12-09 17:51 +0100
                Re: order independent hash? Chris Angelico <rosuav@gmail.com> - 2011-12-10 04:13 +1100
                Re: order independent hash? Lie Ryan <lie.1296@gmail.com> - 2011-12-11 10:58 +1100
                Re: order independent hash? Chris Angelico <rosuav@gmail.com> - 2011-12-11 11:17 +1100
                Re: order independent hash? Lie Ryan <lie.1296@gmail.com> - 2011-12-11 14:04 +1100
        Re: order independent hash? Lie Ryan <lie.1296@gmail.com> - 2011-12-05 00:29 +1100
      Re: order independent hash? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-01 20:29 -0800
      Re: order independent hash? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-02 04:33 +0000

csiph-web