A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-November/057869.html below:

[Python-Dev] Should the default equality operator compare values instead of identities?

[Python-Dev] Should the default equality operator compare values instead of identities? [Python-Dev] Should the default equality operator compare values instead of identities?Noam Raphael noamraph at gmail.com
Wed Nov 2 22:11:25 CET 2005
I've looked for classes in my /usr/lib/python2.4 directory. I won't go
over all the 7346 classes that were found there, but let's see:

"identity objects" that will continue to work because they contain
other "identity objects"
========================
SocketServer, and everything which inherits from it (like HTTPServer)
Queue
csv (contains _csv objects)

"value objects" that would probably gain a meaningful equality operator
============================================
StringIO
ConfigParser
markupbase, HTMLParser
HexBin, BinHex
cgi.FieldStorage
AST Nodes

others
======
Cookie - inherits from dict its __eq__ method.

I'll stop here. I was not strictly scientific, because I chose classes
that I thought that I might guess what they do easily, and perhaps
discarded classes that didn't look interesting to me. But I didn't
have any bad intention when choosing the classes. I have seen no class
that the change would damage its equality operator. I have seen quite
a lot of classes which didn't define an equality operator, and that a
value-based comparison would be the right way to compare them.

I'm getting more convinced in my opinion.

Noam
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