[Python-Dev] NotImplemented reaching top-level

Brett Cannon bcannon at gmail.com
Sun Dec 25 20:55:11 CET 2005


On 12/25/05, Armin Rigo <arigo at tunes.org> wrote:
> Hi Reinhold,
>
> On Sun, Dec 25, 2005 at 12:37:53PM +0100, Reinhold Birkenfeld wrote:
> > > that nobody fully understands the convoluted code paths of abstract.c
> > > any more :-(
> >
> > Time for a rewrite?
>

Maybe.  Also realize we will have a chance to clean it up when Python
3 comes around since the classic class stuff will be ripped out.  That
way we might have a chance to streamline the code.

> Of course, speaking of a rewrite, PyPy does the "right thing" in these
> two areas.  Won't happen to CPython, though.  There are too much
> backward-compatibility issues with the PyTypeObject structure; I think
> we're doomed with patching the bugs as they show up.
>
> Looking up in the language reference, I see no mention of NotImplemented
> in the page about __add__, __radd__, etc.  I guess it's a documentation
> bug as well, isn't it?  The current code base tries to implement the
> following behavior: Returning NotImplemented from any of the binary
> special methods (__xxx__, __rxxx__, __ixxx__) makes Python proceed as if
> the method was not defined in the first place.
>

This is what I always assumed the behaviour was supposed to be, so I
am quite happy to go with that.

-Brett


More information about the Python-Dev mailing list