pypy don't do generators

It does do some other stuff. Ok, to clarify I’m actually talking about RPython, the subset of python (rpython code runs under python) that is used by the pypy team to write the interpreter for python. The point is that pypy has a whole translation thing that can take rpython into about anything, including c code, making it much faster. But to get that benefit you need to be using rpython, not python. That means, for instance, no generators. The rest I can somehow get over. For instance you can’t use .so modules (afaik). So you rewrite some things in python. But most of the important “batteries included” modules are already in the rpython support lib, so you don’t really need to rewrite much (except numpy, which seems to have the beginning of support). Back to generators – it seems no one would be opposed to an addition of generator support in rpython, but it is said to be very hard, in the order of supporting stackless. Except for an intro to rpython (just a presentation) and going through some of the code through pdb/vim, I haven’t grokked it in the least. Someone reading this: Give me generator support for hanuka! Thanks!!

update: After using pypy for a week, trying to make a signal implementation that actually works in rpython (sorry for lack of capitalization), I came to several realizations:

  • lists in rpython are not lists in python (just reading the documentation wasn’t enough for me, but hitting a wall was)
  • creating code on the fly (before starting the rpython translation) is cool
  • **kw is also not rpython (hence the code creation trick I used, to make a function that already takes the correct arguments, with correct defaults)
  • rpython lists can contain instances, they can containĀ  classes, they can’t contain instances not derived from the same base, and you can’t call methods.
  • A lower form of signals where the user who does the connect must know the class of the target is possible, but not very useful.

And last but not least, this is not a top priority for me. So I’m just keeping this info for the next time I start up on pypy, which I really believe is a great project, and also a great learning opportunity for me, sometime in the future.

Leave a Reply