Archive for October, 2007

pypy don't do generators

Wednesday, October 31st, 2007

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.

one of my two favorite comic groups

Sunday, October 21st, 2007

Always liked the song, this is a neat twist: original at xkcd.com/312
some say the world was written in perl, some say lisp

Workshot

Monday, October 15th, 2007

This showes my python based geometry server and algorithms. It is basically a implementation of computing a 2d celldecomposition (arrangement), and the display is done using pygtk and opengl, and twisted for the networking, a better combination then wx+twisted (I no longer have any timeouts, nor do I have to move the mouse to force processing of network events, and ctrl-c actually works). Other then that, like always, the code is not very good, but it works. The right showes the current bug being investigated – the shape on the left is symmetric, and the resulting graph on the right should be too, but it isn’t. Probably more numerical inaccuracies (lines that should be parallel but are not, etc.).

NShape Visibility Bug

Xorg

Tuesday, October 2nd, 2007

Should I develop on Xorg? I’m thinking this is a good idea for several reasons:

* I lack a pet c++ project (or c project for that matter). I’m doing python all day, and I’m losing c++/c.

* I have some pet peeves. The most annoying is problems with my new laptop’s intel driver. I specifically set out to get a laptop with OSS drivers, and got one (for video at least), and now they suck! I get hangs when running qemu, some games don’t have iDTS (spring RTS). And another thing is Xephyr, which I’d like to improve in a small manner.

The con is of course that Xorg is a motherfuckingly huge project, with autoconf etc. At least it is modularaized.

And then again I have three dual core machines that should be seeing some action some way..

Will see.

Driving Simulator for.. Drivers! (and stuff)

Monday, October 1st, 2007

What is the biggest problem on the roads? Death. easy. How do you prevent it? (this is a rhetorical question) You write a driving simulator and distribute it through the government which requires passing it to drive in the country.

Demo/Screensaver idea: based on computation of visibility polygon. Define a region (make it some random simple polygon). randomly choose the positions of two groups of people. Let each person randomly move and try to attack a member of the opposite group. Make it 3d or 2d with a 3d camera view, and move the camera / attach it to someone etc.