[pypy-dev] special methods

Christian Tismer tismer at stackless.com
Wed Mar 28 22:38:05 CEST 2007

On 28.03.2007, at 20:19, Simon Burton wrote:

> On Wed, 28 Mar 2007 19:54:35 +0200
> Christian Tismer <tismer at stackless.com> wrote:
>> This looks good, congrats!
>> I had a different approach in mind which
>> would work without explicitly adding a pass to the
>> annotator, no idea which idea is more practical.
>> What I wanted to do is a tiny patch to flow space
>> that allows to add little plugins for extension.
>> My plugin would intercept things like str(...)
>> during flowing, and rewrite accordingly. This is quite
>> similar to what you did, but does things earlier.
> Yes, this is what Richard suggested also, but don't we
> need the annotation ? Otherwise we don't know when to intercept str 
> (...).

Yes you are right.
Well maybe not so right.
Is there any object that has no __str__ method?
If yes, then this is an RPython syntax error.

I thing we *always* can call the object's __str__ method if it
is RPython code.
What needs to be added is a handler routine. It must be registered
as a function that specializes on the type of its argument. This
way it will be the right __str__ call for every type.

ciao -- chris

More information about the Pypy-dev mailing list