[pypy-dev] Support for __getitem__ in rpython?
hakan at debian.org
Mon Dec 29 16:15:09 CET 2008
On Sat, Dec 27, 2008 at 7:45 PM, Armin Rigo <arigo at tunes.org> wrote:
> 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
Atatched is a small patch for the annotator that makes it treat None
and NotImplemented alike. This is all that is needed for most cases as
all NotImplemented are typically removed by the optimisations
performed by the annotator.
At http://hakan.ardoe.net/pypy/ I have placed special_methods.py that
adds support for the methods listed below together with 42 test
including the relevant parts of test_augassign.py and test_binop.py
from the cpython source (somewhat modified to work). The methods
currently supported are:
__str__, __repr__, __len__, __getitem__, __setitem__, __add__,
__mul__, __sub__, __div__, __floordiv__, __mod__, __xor__, __rshift__,
__lshift__, __radd__, __rmul__, __rsub__, __rdiv__, __rfloordiv__,
__rmod__, __rxor__, __rrshift__, __rlshift__, __iadd__, __imul__,
__isub__, __idiv__, __ifloordiv__, __imod__, __ixor__, __irshift__,
With this implementation, the opperation str(o) calls o.__str__(), but
the opperation "%s"%o does not. I don't know why.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1370 bytes
Desc: not available
More information about the Pypy-dev