Re: [Tutor] hash value input

2010-01-30 Thread Kent Johnson
On Sat, Jan 30, 2010 at 4:56 AM, spir wrote: > I'm surprised of this, for this should create as many indexes (in the > underlying array actually holding the values) as there are integer keys. With > possibly huge holes in the array. Actually, there will certainly be a > predefined number of in

Re: [Tutor] hash value input

2010-01-30 Thread Dave Angel
spir wrote: On Fri, 29 Jan 2010 08:23:37 -0800 Emile van Sebille wrote: So, how does python do this? Start here... http://effbot.org/zone/python-hash.htm Great, thank you! From the above pointed page: For ordinary integers, the hash value is simply the integer itself

Re: [Tutor] hash value input

2010-01-30 Thread spir
On Fri, 29 Jan 2010 08:23:37 -0800 Emile van Sebille wrote: > > So, how does python do this? > > > > Start here... > > http://effbot.org/zone/python-hash.htm Great, thank you! From the above pointed page: === For ordinary integers, the hash value is simply the integer itself (unless it’

Re: [Tutor] hash value input

2010-01-29 Thread Kent Johnson
On Fri, Jan 29, 2010 at 1:20 PM, Rich Lovely wrote: > I've played with this a little.  The following class was quite handy for this: > > class BrokenHash(object): >    def __init__(self, hashval): >        self.hashval = hashval >    def __hash__(self): >        return self.hashval > > It basical

Re: [Tutor] hash value input

2010-01-29 Thread Rich Lovely
On 29 January 2010 16:54, Kent Johnson wrote: > On Fri, Jan 29, 2010 at 8:03 AM, spir wrote: > >> I recently discovered that Lua uses the data's address (read: id) as input >> to the hash func. This allows Lua tables (a kind of more versatile >> associative array) to use _anything_ as key, sinc

Re: [Tutor] hash value input

2010-01-29 Thread Kent Johnson
On Fri, Jan 29, 2010 at 8:03 AM, spir wrote: > I recently discovered that Lua uses the data's address (read: id) as input to > the hash func. This allows Lua tables (a kind of more versatile associative > array) to use _anything_ as key, since the id is guaranteed not to change, > per definiti

Re: [Tutor] hash value input

2010-01-29 Thread Emile van Sebille
On 1/29/2010 5:03 AM spir said... Hello, What actually is hashed when a data item is used a dict key? If possible, I would also like some clues on the method used to produce the hash value. (Maybe a pointer to the the relevant part of the python source, if clear and/or commented.) The reason

[Tutor] hash value input

2010-01-29 Thread spir
Hello, What actually is hashed when a data item is used a dict key? If possible, I would also like some clues on the method used to produce the hash value. (Maybe a pointer to the the relevant part of the python source, if clear and/or commented.) The reason why I ask is the well known limitat