bytecodehacks 0.20 - Python gets macros

Michael Hudson mwh21 at cam.ac.uk
Mon May 17 04:25:20 EDT 1999


My bytecodehacks package has been updated and now conatins a macro
package of sorts. If I understand the terminology correctly, these are
semantic rather than syntactic macros. They cannot be used to invent
new syntax for Python, but they can be used to do things that are not
possible without it. For example:

    def f(x):
        i = 0
        while pre_incr(i) < len(x):
            if setq(c, x[i]) == 3:
                print c, 42

pre_incr(i) acts a lot like ++i in some other language.
setq(x,v) is an assignment expression.

Documentation is online at 

    http://starship.python.net/crew/mwh/bch/index.html

The package is downloadable from the ftp directory:

    ftp://starship.python.net/pub/crew/mwh/

The packages that I'm talking about today are

    ftp://starship.python.net/pub/crew/mwh/bytecodehacks-0.20.tar.gz

and (containing the built html documentation)

    ftp://starship.python.net/pub/crew/mwh/bytecodehacks-doc-0.20.tar.gz

althopugh by the time you get there there's every chance I'll have
updated the packages again...

Have fun!

Michael




More information about the Python-list mailing list