A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2014-July/135364.html below:

[Python-Dev] == on object tests identity in 3.x

[Python-Dev] == on object tests identity in 3.x [Python-Dev] == on object tests identity in 3.xEthan Furman ethan at stoneleaf.us
Tue Jul 8 04:29:17 CEST 2014
On 07/07/2014 06:18 PM, Andreas Maier wrote:
> Am 2014-07-08 01:50, schrieb Ethan Furman:
>>
>> I never add __eq__ to my classes until I come upon a place where I need to check if two instances of those classes are
>> 'equal', for whatever I need equal to mean in that case.
>
> With that strategy, you would not be hurt if the default implementation raised an exception in case the two objects are
> not identical. ;-)

Yes, I would.  Not identical means not equal until I say otherwise.  Raising an exception instead of returning False 
(for __eq__) would be horrible.

--
~Ethan~
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4