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/2005-October/057811.html below:

[Python-Dev] PEP 351, the freeze protocol

[Python-Dev] PEP 351, the freeze protocolOren Tirosh orent at hishome.net
Mon Oct 31 18:28:26 CET 2005
On 10/31/05, Antoine Pitrou <solipsis at pitrou.net> wrote:
>
> > It allows everything in Python to be both mutable and hashable,
>
> I don't understand, since it's already the case. Any user-defined object
> is at the same time mutable and hashable.

By default, user-defined objects are equal iff they are the same
object, regardless of their content. This makes mutability a
non-issue.

If you want to allow different objects be equal you need to implement
a consistent equality operator (commutative, etc), a consistent hash
function and ensure that any attributes affecting equality or hash
value are immutable. If you fail to meet any of these requirements and
put such objects in dictionaries or sets it will result in undefined
behavior that may change between Python versions and implementations.

  Oren
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