[pypy-dev] special methods

Simon Burton simon at arrowtheory.com
Mon Mar 26 23:30:15 CEST 2007


The attached script is an attempt to get __str__ to work in rpython.
After annotation, it looks for str(someinstance), rewriting the block to call __str__.
Then the modified blocks are fed back into the annotator.

It seems to work. (And now i know a lot more about the internals of the translation process...)

I had a think about over-riding consider_op_str. It would seem natural for this code
to go there, but the annotator is not really set up to handle rewriting.

Why do i not need to manually call the flow operation on the __str__ ? (see the flow_str function) 
It seems the annotator somehow must re-trigger the flowing operation when it
finds that __str__ is being called.

thanks,

Simon.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: special.py
Type: text/x-python
Size: 3557 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20070326/a2f5748b/attachment.py>


More information about the Pypy-dev mailing list