Ethan Furman wrote:
Ulrich Eckhardt wrote:
If two equal objects have different hashes, they
will be stored in different places in the hash map. Looking for
object1 will then not turn up with object2, even though they are equal.
In this case this is the behavior I want.
You can't rely on
Gregory Ewing wrote:
Ethan Furman wrote:
Ulrich Eckhardt wrote:
If two equal objects have different hashes, they
will be stored in different places in the hash map. Looking for
object1 will then not turn up with object2, even though they are equal.
In this case this is the behavior I
On 5/19/2011 11:33 PM, Ulrich Eckhardt wrote:
For that reason, it is generally useful to use immutable types like
integers, floats, strings and tuples thereof as keys. Since you can't change
them, you basically have the guarantee that they hash the same.
Right. It's something of a lack
On 22-5-2011 0:55, John Nagle wrote:
On 5/19/2011 11:33 PM, Ulrich Eckhardt wrote:
For that reason, it is generally useful to use immutable types like
integers, floats, strings and tuples thereof as keys. Since you can't change
them, you basically have the guarantee that they hash the same.
On Sat, 21 May 2011 15:55:56 -0700, John Nagle wrote:
On 5/19/2011 11:33 PM, Ulrich Eckhardt wrote:
For that reason, it is generally useful to use immutable types like
integers, floats, strings and tuples thereof as keys. Since you can't
change them, you basically have the guarantee that
Ethan Furman wrote:
Several folk have said that objects that compare equal must hash equal,
and the docs also state this
http://docs.python.org/dev/reference/datamodel.html#object.__hash__
I'm hoping somebody can tell me what horrible thing will happen if this
isn't the case? Here's a toy
On Thu, May 19, 2011 at 10:43 PM, Ethan Furman et...@stoneleaf.us wrote:
Several folk have said that objects that compare equal must hash equal, and
the docs also state this
http://docs.python.org/dev/reference/datamodel.html#object.__hash__
I'm hoping somebody can tell me what horrible thing
Ethan Furman wrote:
Several folk have said that objects that compare equal must hash equal,
and the docs also state this
http://docs.python.org/dev/reference/datamodel.html#object.__hash__
I'm hoping somebody can tell me what horrible thing will happen if this
isn't the case?
If you were
On 20/05/2011 07:33, Ulrich Eckhardt wrote:
Ethan Furman wrote:
Several folk have said that objects that compare equal must hash equal,
and the docs also state this
http://docs.python.org/dev/reference/datamodel.html#object.__hash__
I'm hoping somebody can tell me what horrible thing will
On Sat, May 21, 2011 at 1:50 AM, MRAB pyt...@mrabarnett.plus.com wrote:
[snip]
Is this strictly true? I thought that the hash value, an integer, is
moduloed (Is that how you spell it? Looks weird!) with the number of
array elements to give an index into the array, so different hashes
could
On Fri, May 20, 2011 at 9:20 AM, Chris Angelico ros...@gmail.com wrote:
On Sat, May 21, 2011 at 1:50 AM, MRAB pyt...@mrabarnett.plus.com wrote:
[snip]
Is this strictly true? I thought that the hash value, an integer, is
moduloed (Is that how you spell it? Looks weird!) with the number of
Chris Rebert wrote:
On Thu, May 19, 2011 at 10:43 PM, Ethan Furman et...@stoneleaf.us wrote:
Several folk have said that objects that compare equal must hash equal, and
the docs also state this
http://docs.python.org/dev/reference/datamodel.html#object.__hash__
I'm hoping somebody can tell me
Peter Otten wrote:
Ethan Furman wrote:
Several folk have said that objects that compare equal must hash equal,
and the docs also state this
http://docs.python.org/dev/reference/datamodel.html#object.__hash__
I'm hoping somebody can tell me what horrible thing will happen if this
isn't the
On Fri, May 20, 2011 at 10:36 AM, Chris Kaynor ckay...@zindagigames.com wrote:
I think the question was: can this dummy code ever produce a set containing
less then itemCount items (for 0 itemCount 2**32)?
In CPython, no. Even when you get a hash collision, the code checks
to see whether the
Ulrich Eckhardt wrote:
Ethan Furman wrote:
Several folk have said that objects that compare equal must hash equal,
and the docs also state this
http://docs.python.org/dev/reference/datamodel.html#object.__hash__
I'm hoping somebody can tell me what horrible thing will happen if this
isn't the
Ethan Furman wrote:
Several folk have said that objects that compare equal must hash equal,
and the docs also state this
http://docs.python.org/dev/reference/datamodel.html#object.__hash__
Two things I didn't make clear originally:
I'm using Python3.
My objects (of type Wierd) obey the
On Fri, May 20, 2011 at 10:56 AM, Ethan Furman et...@stoneleaf.us wrote:
Chris Rebert wrote:
On Thu, May 19, 2011 at 10:43 PM, Ethan Furman et...@stoneleaf.us wrote:
Several folk have said that objects that compare equal must hash equal,
and
the docs also state this
Am 20.05.2011 17:50, schrieb MRAB:
Is this strictly true? I thought that the hash value, an integer, is
moduloed (Is that how you spell it? Looks weird!) with the number of
array elements to give an index into the array, so different hashes
could give the same index, and objects with different
On 20/05/2011 20:01, Christian Heimes wrote:
Am 20.05.2011 17:50, schrieb MRAB:
Is this strictly true? I thought that the hash value, an integer, is
moduloed (Is that how you spell it? Looks weird!) with the number of
array elements to give an index into the array, so different hashes
could
Ethan Furman wrote:
Peter Otten wrote:
Ethan Furman wrote:
Several folk have said that objects that compare equal must hash equal,
and the docs also state this
http://docs.python.org/dev/reference/datamodel.html#object.__hash__
I'm hoping somebody can tell me what horrible thing will
Peter Otten wrote:
Ethan Furman wrote:
Peter Otten wrote:
Ethan Furman wrote:
Several folk have said that objects that compare equal must hash equal,
and the docs also state this
http://docs.python.org/dev/reference/datamodel.html#object.__hash__
-- class Wierd():
... def
On Fri, 20 May 2011 21:17:29 +0100, MRAB wrote:
On 20/05/2011 20:01, Christian Heimes wrote:
Am 20.05.2011 17:50, schrieb MRAB:
Is this strictly true? I thought that the hash value, an integer, is
moduloed (Is that how you spell it? Looks weird!) ...
I don't think 'moduloed' is an existing
On 21/05/2011 01:47, Steven D'Aprano wrote:
On Fri, 20 May 2011 21:17:29 +0100, MRAB wrote:
On 20/05/2011 20:01, Christian Heimes wrote:
Am 20.05.2011 17:50, schrieb MRAB:
Is this strictly true? I thought that the hash value, an integer, is
moduloed (Is that how you spell it? Looks weird!)
On Sat, 21 May 2011 02:02:48 +0100, MRAB wrote:
On 21/05/2011 01:47, Steven D'Aprano wrote:
On Fri, 20 May 2011 21:17:29 +0100, MRAB wrote:
On 20/05/2011 20:01, Christian Heimes wrote:
Am 20.05.2011 17:50, schrieb MRAB:
Is this strictly true? I thought that the hash value, an integer, is
Several folk have said that objects that compare equal must hash equal,
and the docs also state this
http://docs.python.org/dev/reference/datamodel.html#object.__hash__
I'm hoping somebody can tell me what horrible thing will happen if this
isn't the case? Here's a toy example of a class I'm
25 matches
Mail list logo