Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.04; 'type,': 0.07; 'python': 0.08; 'deletion': 0.09; 'etc).': 0.09; 'historic': 0.09; 'reply-to:addr:comp.lang.python': 0.09; 'size)': 0.09; 'specified,': 0.09; 'to:addr:comp.lang.python': 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; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'insert': 0.19; 'cc:no real name:2**0': 0.20; 'memory': 0.21; 'mechanism': 0.21; 'result.': 0.21; 'input': 0.22; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; '(usually': 0.23; 'archiving': 0.23; 'dictionary': 0.23; 'pair': 0.23; 'defined': 0.24; 'string': 0.24; 'cc:2**0': 0.24; 'library.': 0.24; 'function': 0.27; 'fixed': 0.29; 'cc:addr:python.org': 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; "isn't": 0.33; 'header:User-Agent:1': 0.33; 'object': 0.33; 'fri,': 0.34; 'done': 0.34; 'from:addr:googlemail.com': 0.34; 'normally': 0.34; 'received:209.85.212': 0.34; 'too': 0.34; 'all.': 0.34; 'algorithms': 0.34; 'stores': 0.34; 'operations': 0.35; 'uses': 0.36; 'friday,': 0.37; 'but': 0.37; 'run': 0.37; 'received:google.com': 0.37; 'think': 0.37; 'could': 0.37; 'steven': 0.38; 'received:209.85': 0.38; 'programming.': 0.39; 'tables': 0.39; 'clearly': 0.39; 'called': 0.40; "it's": 0.40; 'received:209': 0.40; 'management': 0.60; 'type': 0.61; '2011': 0.61; 'your': 0.61; 'happen': 0.61; 'grow': 0.62; 'auto': 0.63; 'protection': 0.67; 'collection': 0.69; 'header:Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.72; 'reply- to:addr:googlegroups.com': 0.74; 'concept': 0.74; 'verification': 0.78; 'inquiring': 0.84; 'received:209.85.212.56': 0.91; 'received :mail-vw0-f56.google.com': 0.91; 'cryptography': 0.93 Newsgroups: comp.lang.python Date: Thu, 1 Dec 2011 21:48:27 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=1.168.133.35; posting-account=5JdMBQoAAABHnS4mjpqEzxnmWtgiiVNw References: <30715729.411.1322753732534.JavaMail.geo-discussion-forums@pret21> <4ED7A2CE.6070306@davea.name> <6366868.86.1322800180523.JavaMail.geo-discussion-forums@pret21> User-Agent: G2/1.0 X-Google-Web-Client: true MIME-Version: 1.0 Subject: Re: order independent hash? From: 88888 Dihedral To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: comp.lang.python@googlegroups.com List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 80 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1322804917 news.xs4all.nl 6864 [2001:888:2000:d::a6]:34975 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:16530 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 > 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 =A0into the hash > > 2. deletion of a (key, value) from the hash > > 3. inquiring =A0a hash by a key to retrieve the value if the (key, valu= e) > > 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-fix= ed size of (k,v) pairs. >=20 > That's a hash table - think of a Python dictionary: >=20 > On Fri, Dec 2, 2011 at 3:33 PM, Steven D'Aprano > wrote: > > Python dicts are hash tables. >=20 > Although strictly speaking, isn't that "Python dicts are implemented > as hash tables in CPython"? Or is the hashtable implementation > mandated? Anyway, near enough. > =20 > 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. >=20 > 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? A hash function is different from a hash or so called a hash table in my post.=20 =20 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. =20 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 signature= s only clearly in my post. =20 What I said a hash which is lifted as a basic type in python is called a d= ictionary in python.=20 It is called a map in c++'s generics library.=20