Pex

Pex is a preprocessor for Cython developed at PnyLab LLC.

Numerics

Pex provides important experience and Cython will provide almost identical capabilities, but through a more general mechanism: Supporting the buffer PEP natively.

Auto-pickling and dictionary coercion

Automatically generating __reduce__ and __setstate__ is a Cython goal and is already done by Pex.

Dictionary coercion is a nice idea that Cython should copy:

Pragmas

Pex has a pragma syntax that Cython will probably not adopt; although the feature seems to be very valuable. One can either polish the syntax a bit, or fine some subset of module header comments, decorators and with statements. Command-line pragmas should of course be supported. (Config files? Isn't that what setup.py is?) Perhaps syntax similar to specifying the encoding PEP 263

Useful pragmas for safer mode:

For speed:

Exception handling

Dan made a very good point that exceptions should always be propagated, at least by default, rather than strange behaviour being the default. We'll look into this.

Faster serialization

Pex is able to automatically create fast dump/load methods for simple classes. While useful, this seems to be more in the application domain than language domain because it is so tightly coupled with trade-offs determined by the type of data, type of inter-object references etc.. At the same time, it's a very useful feature. Ways this can be handled:

pxd generation

Pex has a simpler module concept: All files as "px" files which serves the role both as pxds and pyxs for a Cython module. In Cython we'd like to tweak that into this:

cimport vs. import

We would phase out cimport, letting cimport automatically be an import if the pxd (or, as above, pyx) file can be located.

Automatic str, cmp and eq overloads

Cython didn't reach a conclusion; it's the kind of things that are nice to have while they don't fit into emulating Python. Metaprogramming would solve this too ("compile-time metaclass support"?) or a method generator of sorts

Build system

Pex has system that mimics the Python import statement; one can simply invoke pex on a px sourcefile (or use the pex module from Python to import a px file) and pex will automatically rebuild the appropriate files and import them.

There could be potential for direct code reuse in this area.

Build path control

Sourcefiles in pex can carry information about their include paths. Cython may provide something similar but in a much more declarative syntax.

enhancements/pex (last edited 2008-07-16 07:21:06 by robertwb)