[Python-3000] how about switching to a preprocessor? (Re: A better way to initialize PyTypeObject)
mike.klaas at gmail.com
Sun Dec 3 00:09:35 CET 2006
On 12/2/06, Fredrik Lundh <fredrik at pythonware.com> wrote:
> > Regardless, one could take a Pyrex bent on this and having Python-like
> > method declarations but have C as the code body::
> (some days, I wonder if we shouldn't just include Pyrex and tell every-
> one to use that for *all* their extension work. Greg? how much work
> would it be to equip Pyrex with a "retargetable" backend?)
+1. Pyrex makes extension writing significantly less painful.
Perhaps the right path would be to add a mode that de-emphasized the
python-compatability aspect of pyrex (automatic python <-> c
conversion points), and added support for some of the things necessary
in c but currently difficult in pyrex (like calling the initialization
macro of a PyCObject). Add string, list, sequence, dict types, and a
few restrictions (like on overriding built-ins) and you're close to
something that can generate idiomatic c.
Reducing the pyrex magic and adding more detailed errors to the code
generator should eliminate much of the "code-peering" that is
currently necessary (at least, by me) when writing extensions.
More information about the Python-3000