On Fri, Dec 12, 2008 at 6:11 PM, Armin Rigo <ar...@tunes.org> wrote:
> Hi Hakan,
>
> On Fri, Dec 12, 2008 at 04:49:17PM +0100, Hakan Ardo wrote:
>> How about instead doing:
>>
>>    (...)
>
> Ah, using 'notify' to force a reflow.  Obscure :-/

OK, what's the intended use of the notify feature?

The reflow is happening with the previous solution as well. Presumable
because p.simple_call(s_index) gets the getitem opperation registered
as a call site of the __getitem__ method? Maybe a better solution is
to register as a call site of the helper? The following (from
rpython/controllerentry.py) seems to do the trick:

def call_helper(func,s_args):
    bk = getbookkeeper()
    s_callable = bk.immutablevalue(func)
    return bk.emulate_pbc_call(bk.position_key, s_callable, s_args,
                              callback = bk.position_key)


At http://hakan.ardoe.net/pypy/ there is now an implementation of
__add__/__radd__ combination in getsetitem_support.py that calls the
correct method in all cases I could come up with (test_add.py). It
cannot yet handle that the methods return NotImplemented. Would it be
possible to handle that in a similar manner to how None is handled?
That would remove all unneeded tests if the annotator can prove that a
call will always/never return NotImplemented, right?

-- 
Håkan Ardö
_______________________________________________
pypy-dev@codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Reply via email to