detect in Python
This is a simple preprocessor I have made which implements the
detect control structure, invented by Arne Halaas in the
early seventies (Halaas 1975). It has been adapted to the Python
syntax, and (for now) the "events" are placed at the end of the
"clean-up" blocks, because they cause immediate exit from the loop. In
the future, I might fix this so that it will resemble the original
more closely, with the event strings starting the clean-up blocks.
Hopefully, I will add some descriptions of the statement and its usage here, but for now, there is only the code...
partition.py is only an example. You can run it like
this:
$ dpython partition.py
... assuming that you put all the .py-files in your
PYTHONPATH and dpython in your PATH, and change it to
executable.
Note: You have to change the string
"/store/bin/python" in dpython to the
absolute path of your python executable. (For some reason I couldn't
get sys.executable to return anything useful...)
Remember - this is a very early version. Don't expect
much. :)
References