Announcing bytecodehacks 0.10
Michael Vanier
mvanier at bbb.caltech.edu
Wed May 12 17:57:43 EDT 1999
Michael Hudson <mwh21 at cam.ac.uk> writes:
> If you've been following the "Python is too slow" thread of late, you
> might have noticed my sneaky bytecode rewriting functions.
>
> Well, they've been rewritten, added to and generally banged on, and
> remarkably enough, there's nearly full documentation (Thanks to Fred
> Drake and all the others for making making documentation so easy).
>
> The package (and that's how it's distributed) splits into two parts -
> the byte code editing routines and the "bytecodehacks" that are
> usuable without a degree in python arcanery, although one might help
> understand some of the consequences.
Cool stuff, Michael! Keep up the good work :-)
> bytecodehacks.xapply - a sort-of lazy apply
>
> from bytecodehacks.xapply import xapply
>
> def add(x,y):
> return x+y
> add1=xapply(add,1)
> add1(1) => 2
Maybe "curry" would have been a better name.
> bytecodehacks.setq - this one should interest people!
>
> You want assignment expressions? Have them!
>
> def f(x):
> while setq(x,x-1):
> print x
> from bytecodehacks import setq
> g=setq.setqize(f)
> g(4)
> 3
> 2
> 1
>
Now we can put that thread to rest for good :-)
We'll-make-python-into-scheme-yet-even-if-we-have-to-drag-it-
kicking-and-screaming-all-the-way-ly y'rs,
Mike
-------------------------------------------------------------------------
Mike Vanier mvanier at bbb.caltech.edu
Department of Computation and Neural Systems, Caltech 216-76
Will optimize nonlinear functions with complex parameter spaces for food.
More information about the Python-list
mailing list