On Tue, May 15, 2012 at 3:27 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
Why? I can't see any purpose in implementing __eq__ this way, but I
don't see how it's broken (assuming that __hash__ is actually
implemented somehow and doesn't just raise TypeError). The
requirement is that if two
Am 15.05.2012 07:27, schrieb Ian Kelly:
Why? I can't see any purpose in implementing __eq__ this way, but I
don't see how it's broken (assuming that __hash__ is actually
implemented somehow and doesn't just raise TypeError). The
requirement is that if two objects compare equal, then they
On Monday, May 14, 2012 8:35:36 PM UTC-5, alex23 wrote:
It looks like this has changed between Python 2 and 3:
If a class does not define an __eq__() method it should not define a
__hash__() operation either; if it defines __eq__() but not
__hash__(), its instances will not be usable as
On Tue, May 15, 2012 at 3:25 AM, Christian Heimes li...@cheimes.de wrote:
Code explains more than words. I've created two examples that some issues.
Mutable values break dicts as you won't be able to retrieve the same
object again:
Sure, you'll get no argument from me on that. I was more
Noob alert: writing my first Python class library.
I have a straightforward class called Utility that lives in Utility.py.
I'm trying to get a handle on best practices for fleshing out a library. As
such, I've done the following for starters:
def __str__(self):
return str(type(self))
#
On Sun, May 13, 2012 at 12:11 PM, Bob Grommes bob.grom...@gmail.com wrote:
Noob alert: writing my first Python class library.
I have a straightforward class called Utility that lives in Utility.py.
I'm trying to get a handle on best practices for fleshing out a library. As
such, I've done
On Sun, May 13, 2012 at 12:11 PM, Bob Grommes bob.grom...@gmail.com wrote:
Noob alert: writing my first Python class library.
I have a straightforward class called Utility that lives in Utility.py.
I'm trying to get a handle on best practices for fleshing out a library. As
such, I've done
On 05/14/2012 07:38 PM, Chris Kaynor wrote:
On Sun, May 13, 2012 at 12:11 PM, Bob Grommes bob.grom...@gmail.com wrote:
SNIP
The rule is that, if two objects return different results from
__hash__, they should never compare equal. The opposite rule also
holds true: if two objects compare
On May 14, 5:11 am, Bob Grommes bob.grom...@gmail.com wrote:
Obviously there is some sort of default implementation of __hash__()
at work and my implementation of _eq_() has somehow broken it.
Can anyone explain what's going on?
It looks like this has changed between Python 2 and 3:
If a
Am 13.05.2012 21:11, schrieb Bob Grommes:
Noob alert: writing my first Python class library.
I have a straightforward class called Utility that lives in Utility.py.
I'm trying to get a handle on best practices for fleshing out a library. As
such, I've done the following for starters:
On Mon, May 14, 2012 at 7:50 PM, Christian Heimes li...@cheimes.de wrote:
Am 13.05.2012 21:11, schrieb Bob Grommes:
Noob alert: writing my first Python class library.
I have a straightforward class called Utility that lives in Utility.py.
I'm trying to get a handle on best practices for
11 matches
Mail list logo