osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why does __ne__ exist?


On 01/07/2018 04:57 PM, Chris Angelico wrote:
> On Mon, Jan 8, 2018 at 11:35 AM, Ben Finney wrote:
>> Chris Angelico writes:

>>> Let's put it this way. Suppose that __eq__ existed and __ne__ didn't,
>>> just like with __contains__. Go ahead: sell the notion of __ne__.
>>> Pitch it, show why we absolutely need to allow this.
>>
>> I think ?reject unless absolutely needed? is an unreasonably high bar,
>> which would disqualify most Python language features. So I don't know
>> why you expect this to be so especially strongly argued.
>
> True, I exaggerated a bit. But do you think that, had __ne__ not
> existed for years, its addition could be justified?

Considering we just recently added a matrix-multiplication operator, yes.

--
~Ethan~