>
> It is also said that in a list of may be 10,000 elements(specifically
> integers), hash maps would be a better option to find the occurrence of
> repetitive integers
>
There's a lot of passive voice here, so I have no idea who you mean by
this. Attribution would be nice; otherwise, it almost
On Sun, Dec 01, 2013 at 09:10:42PM +0530, Reuben wrote:
> Hi
>
> Question 1:
> -
> I would like to know the concept of hash map. Additionally, I got to know
> that hash maps are equivalent to dictionaries in python.
>
> I would like to understand the relationship between dictiona
On Sun, Dec 1, 2013 at 7:40 AM, Reuben wrote:
> Hi
>
> Question 1:
> -
> I would like to know the concept of hash map. Additionally, I got to know
> that hash maps are equivalent to dictionaries in python.
>
> I would like to understand the relationship between dictionaries and ha
Hi
Question 1:
-
I would like to know the concept of hash map. Additionally, I got to know
that hash maps are equivalent to dictionaries in python.
I would like to understand the relationship between dictionaries and hash
map better.
Question 2:
--
It is also sa
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
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
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’
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
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
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
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
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
"linda.s" <[EMAIL PROTECTED]> wrote
> what is the use of def __hash__(self)?
> I can not understand the document.
> any example?
First, do you understand what a hash is?
Do you want an example of writing a hash - see Andreas reply.
Or do you want to know when/how to use a hash?
As Andreas sa
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Simple, defining __hash__ on a class allows you to supply a hash value
for instances of your class.
[EMAIL PROTECTED]:~> cat /tmp/hash.py
class X:
def __hash__(self):
print "HASH CALLED"
return 123
print hash(X())
[EMAIL PROTECTED
what is the use of def __hash__(self)?
I can not understand the document.
any example? thanks,
Linda
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Danny Yoo said unto the world upon 2005-03-29 03:37:
*Almost* all ints are fixed points for the hashing function in the
sense that hash(some_int) == some_int. Almost all as:
>>> hash(-1)
-2
Any idea why -1 is the sole exception?
[warning: beginners, skip this. Completely inconsequential CPython d
[EMAIL PROTECTED] said unto the world upon 2005-03-29 03:14:
Quoting Brian van den Broek <[EMAIL PROTECTED]>:
I had thought lookup was by hash value, and thus expected the access
to some_dict to cause troubles. Yet it worked. Is it that lookup is by
hash value, and then equality if need be so as
> *Almost* all ints are fixed points for the hashing function in the
> sense that hash(some_int) == some_int. Almost all as:
>
> >>> hash(-1)
> -2
>
> Any idea why -1 is the sole exception?
[warning: beginners, skip this. Completely inconsequential CPython detail
ahead.]
Hi Brian,
Yeah, I reme
Quoting Brian van den Broek <[EMAIL PROTECTED]>:
> I had thought lookup was by hash value, and thus expected the access
> to some_dict to cause troubles. Yet it worked. Is it that lookup is by
> hash value, and then equality if need be so as to settle ambiguity, or
> have I completely misunders
Danny Yoo said unto the world upon 2005-03-28 14:33:
I know I'm rushing this, so please feel free to ask more questions about
this.
Hi Danny, Orri, and all,
I'm really glad Orri raised the hashing issues he did, and appreciate
your informative posts, Danny. :-)
There are some related things I'v
Well, what I ended up doing is making it so that Nodes are equal if
they have the same 'cargo', but hash based on memory address. If this
wasn't the case, I either wouldn't be able to have multiple Nodes with
the same 'cargo' in a LinkedList, or I wouldn't be able to sort them
properly, among othe
On Sun, 27 Mar 2005, Orri Ganel wrote:
> So, any class that has 'rich comparison methods' defined is unhashable?
> What gives? (See '[Tutor] unhashable objects')
Hi Orri,
If we change what it means for two objects to be equal, hashing won't work
in a nice way until we also make hashing take e
So, any class that has 'rich comparison methods' defined is
unhashable? What gives? (See '[Tutor] unhashable objects')
On Sun, 27 Mar 2005 12:38:09 -0800 (PST), Danny Yoo
<[EMAIL PROTECTED]> wrote:
>
>
> On Sun, 27 Mar 2005, Orri Ganel wrote:
>
> > While I do not have a pressing need to hash a
On Sun, 27 Mar 2005, Orri Ganel wrote:
> While I do not have a pressing need to hash a list, I am curious as to
> why, if lists are unhashable, there is a __hash__() method in the list
> class, which also does not work on lists, but results in a 'TypeError:
> list objects are unhashable'. What'
Hello all,
While I do not have a pressing need to hash a list, I am curious as to
why, if lists are unhashable, there is a __hash__() method in the list
class, which also does not work on lists, but results in a 'TypeError:
list objects are unhashable'. What's the point of including a
__hash__()
25 matches
Mail list logo