On Sun, 18 Aug 2013 09:03:56 +0200
Armin Rigo <ar...@tunes.org> wrote:
> Hi,
> 
> On Sat, Aug 17, 2013 at 8:42 PM, Antoine Pitrou <solip...@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...

Regards

Antoine.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to