A faster Python?, Python compiler, Dylan,...

Skip Montanaro skip at pobox.com
Wed Apr 3 10:24:40 EST 2002


    SM> Have you tried weave?  It's part of SciPy.  From the SciPy front page:
    >> Weave 0.2.1 Now Available: weave is a new package that provides tools
    >> for including C/C++ code within Python code.  The weave.inline()
    >> function executes C code directly within Python, weave.blitz()
    >> translates Python Numeric expressions to C++ for fast execution...

    Jan> Basically weave permits you to put both the C code and the Python
    Jan> code into one file. Not bad, but you still have to write the code
    Jan> twice.  Useful for short C fragments, not long ones.

You're thinking of weave.inline().  I was talking about weave.blitz().
Reread the last statement in the text I quoted, then take a look here:

    http://www.scipy.org/site_content/weave/tutorial.html#Blitz

The example shows creation of a couple of Numeric arrays, followed by the
embedding of a Numeric *Python* expression in a string and a call to
weave.blitz().  There's not a hint of C or C++ code at all.  blitz() does
all the code generation for you.

-- 
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)




More information about the Python-list mailing list