[Python-Dev] cpython: Use a known unique object for the dummy entry.

Antoine Pitrou solipsis at pitrou.net
Sun Aug 18 13:53:42 CEST 2013

On Sun, 18 Aug 2013 09:03:56 +0200
Armin Rigo <arigo at tunes.org> wrote:
> Hi,
> On Sat, Aug 17, 2013 at 8:42 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> >> summary:
> >>   Use a known unique object for the dummy entry.
> Another issue with this change: the dummy object should be of a dummy
> subclass of 'object', rather than of 'object' itself.  When it is
> 'object' itself, a custom __eq__() method will be called, sending what
> should be the dummy object to the pure Python code explicitly, as in
> the example below.  This is bad because ---in addition to calling
> __eq__() with unexpected arguments, which might break some code--- we
> could then take the dummy object, and try to insert it into another
> set...

Indeed. Also, any non-trivial __eq__ will start receiving unexpected
objects and may break in mysterious ways...



More information about the Python-Dev mailing list