[pypy-dev] Support for __getitem__ in rpython?

Paolo Giarrusso p.giarrusso at gmail.com
Sat Dec 27 19:56:51 CET 2008

On 27/12/2008, Armin Rigo <arigo at tunes.org> wrote:
> Hi,
>  On Fri, Dec 26, 2008 at 11:31:53AM +0100, Hakan Ardo wrote:
>  > But if I replace None with NotImplemented, it does not compile
>  > anymore. So, can we get the annotater to treat NotImplemented in a
>  > similar manner as it treats None?

> You can try, but it's messy.  It's not a problem for the annotator but
>  for the later RTyper.  None is implemented as a NULL pointer by the
>  RTyper; I don't know how you would distinguish between None-as-a-NULL
>  and NotImplemented.  You could try to go for something like ((TYPE*) 1),
>  but this doesn't work on top of ootype, where you really have only one
>  NULL value.

I don't know ootype, but why not having a NotImplemented singleton
type, and returning a pointer to its instance? Python has a None
singleton type as well, so it makes sense.

Paolo Giarrusso

More information about the Pypy-dev mailing list