Attack a sacred Python Cow

Michele Simionato michele.simionato at gmail.com
Sat Jul 26 19:20:43 CEST 2008


On Jul 26, 5:28 pm, a... at pythoncraft.com (Aahz) wrote:
> IMO, you made a big mistake in combining your point with two other meaty
> issues (whether method definitions should include self and whether !=
> should use __eq__() as a fallback).
<snip>
>  If solid discussion
> is your goal, I suggest that you wait a couple of weeks and start over
> with a brand-new thread.

I fully subscribe this. The point about __eq__ is legitimate and could
be discussed with quite tones.
I was bitten by this surprising behavior just a few
days ago, I had defined __eq__ and I expected __neq__
to be defined in the obvious way. I saw that it was
not the case and I figured out immediately that
I had to override __neq__ explicitely (I have
the "explicit is better than implicit" mantra
ingrained in my mind too), I did so and everything
worked out as a charm. Total time loss: five minutes.
So, it is not a big point. Still I think
that it would make sense to automatically
define __neq__ as the negation of __eq__.
I suppose the developers did not want to make a special
case in the implementation and this is also a legitimate
concern.

   Michele Simionato



More information about the Python-list mailing list