[pypy-dev] Support for __getitem__ in rpython?

Paolo Giarrusso p.giarrusso at gmail.com
Tue Dec 23 12:29:01 CET 2008

On Tue, Dec 23, 2008 at 12:23, Armin Rigo <arigo at tunes.org> wrote:
> Hi Hakan,
> On Mon, Dec 15, 2008 at 08:47:26PM +0100, Hakan Ardo wrote:
>> cannot yet handle that the methods return NotImplemented. Would it be
>> possible to handle that in a similar manner to how None is handled?
> Not easily.  The annotation framework of PyPy was never meant to handle
> the full Python language, but only a subset reasonable for writing
> interpreters.  Anyway, None-or-integer is not supported either, simply
> because there is no way to represent that in a single machine word.

There are at least two ways, once you have a singleton (maybe static)
None object around:
- box all integers and use only pointers - the slow one;
- tagged integers/pointers that you already use elsewhere. So integers
of up to 31/63 bits get represented directly, while the other ones are
through pointers.

Paolo Giarrusso

More information about the Pypy-dev mailing list