ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-Tutor
python-Tutor
RE: [Tutor] Hashing
by other posts by this author
Aug 11 2001 6:33PM messages near this date
Re: [Tutor] OOP book | RE: [Tutor] Object Oriented References? and a couple of question s <--LONG
>  >>> hash((-1,))
>  1660579479
>  >>> hash((-2,))
>  1660579479
>  
>  aren't these values supposed to be unique?

No hashing produces a spread of values over a range. When two 
or more items et the same hash value they go into a list and 
the lookup accesses the hash, if its single value returns it, 
if not it "does something" with the list. What itv does depends 
on the designer of the hash!

A good(ie readable) source of info on this is Kernighan & Pike's 
recent programming book - sorry forgotten the title for now...
Something like the Practice  of Programming.

The idea is that the total time looking up the hash then 
searching the list is shorter than traversing a single 
long list.

Alan G

PS I've just noticed that Danny has (as uisual) given a 
more complete answer. I'll send this anyway coz of the book 
reference...

_______________________________________________
Tutor maillist  -  Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved