[pypy-dev] Support for __getitem__ in rpython?
hakan at debian.org
Mon Dec 29 23:50:37 CET 2008
On Mon, Dec 29, 2008 at 8:55 PM, Paolo Giarrusso <p.giarrusso at gmail.com> wrote:
>> 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.
> That can be made to work, but if such a method returns None you get
> completely different semantics (trying again with something else) from
> CPython (which will maybe return a failure, or return None for the
> result of such an operation), so you have to restrict the allowed
No, the patch do distinguish between None and NotImplemented. What I
mean is that NotImplemented is treated in a similar manner as to how
None is treated. The following crazy construction do compile and
generate the same result as in cpython ('OK', 'String', 'None',
__add__._annspecialcase_ = 'specialize:argtype(1)'
__radd__._annspecialcase_ = 'specialize:argtype(1)'
if s1 is None: s1='OK'
More information about the Pypy-dev