[pypy-dev] Special methods

Hakan Ardo hakan at debian.org
Fri Dec 4 09:23:55 CET 2009


On Fri, Dec 4, 2009 at 5:36 AM, William Leslie
<william.leslie.ttg at gmail.com> wrote:
> You probably mean SomeInstance rather than SomeObject in that annotator patch.

No, the intention with that construction is to make the
can_be_notImplemented method return True for SomeObject instances, but
defalt to False for all subclasses not implementing the
can_be_notImplemented method. I.e. we want SomeInteger to still
represent an integer and not an "integer or NotImplemented". The
alternative would be to add a can_be_notImplemented method to every
Some.... class returning False.

>>
>> I'm personally -1 to this change. RPython is supposed to be a
>> no-frills language, and I don't really see the advantage or use cases
>> for adding this extra maintenance burden.
>
> Not only is it potentially a maintainence burden, it is also a
> development burden when doing optimisations on the rtyped graphs, for

OK. How about applying (some of) the pathces (http://hakan.ardoe.net/pypy/)?

str_or_none.patch
  A bugfix preventing the call str(o), where o is a "string or None"
object, from segfaulting
  when o becomes None

oper.patch
  Allows the oppertaions int(), and float(), to be defined in methods
of Some... classes.
  The chunk modifying rclass.py should probably be discarded if
speical_methods.py is
  not used.

setitem.patch
  Replace setitem operations with setitem_{key, idx, idx_key} in the
same way as getitem
  is replaced depending on what exceptions are caught.

annotator.patch
  Allows Some... classes to represent "... and NotImplemented" objects
in the same way as
  they can represent "... and None".

-- 
Håkan Ardö



More information about the Pypy-dev mailing list