On Mon, Dec 29, 2008 at 16:15, Hakan Ardo <ha...@debian.org> wrote: > On Sat, Dec 27, 2008 at 7:45 PM, Armin Rigo <ar...@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. 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 semantics in RPython to the "most cases" you are referring to.
Basically, I'd propose that in RPython with your patch, those methods (__add__ etc.) cannot return None (I can't think of a possible use case for an addition returning None), while I guess NotImplemented can only be returned by them, and not by any other function or method (do the current sources ever use NotImplemented?). There must be no function which can choose to return None or NotImplemented. Regards -- Paolo Giarrusso _______________________________________________ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev