[Cython] Lisp inspired transforms
Martin C. Martin
martin at martincmartin.com
Mon Apr 7 23:05:08 CEST 2008
Robert Bradshaw wrote:
>
> Thanks. This looks very interesting. Also, I much prefer this type of
> "macro" to the text-substitution C-style macros that have occasionally
> been suggested.
Glad you like it. It's certainly a lot cleaner.
> One thought that kept going through my head as I was reading this,
> however, is that one of the current defects (in my mind) is its
> inconsistency with actual Python, and the associated learning curve to
> read and write Python. Some of this inconsistency (e.g. (minimal) static
> typing information) is necessary to achieve the kind of speedups we
> need, but I think the focus should be on features that narrow the gap
> between Cython and Python, not those that widen it.
>
> On the other hand, features like the one above can be very useful, and
> it'd be a shame to deny their availability to "power users" (though it
> would take away one thing that I really like about Cython--almost any
> Python programmer can at least read a Cython function without any
> additional knowledge).
Yes, this certainly adds a whole new dimension to Cython that's not in
Python.
Perhaps this is a time to reflect on the goals that Cython has had up to
now, and whether to expand them. Cython and Pyrex started with the goal
of making it easy to wrap existing C/C++ code as Python extensions, but
if you add the ability to declare that a variable has a Python type, you
get a language where you can code Python when you need to, but then when
you need speed, sprinkle a few type declarations around and get code and
speed similar to C.
Is it worth widening the gap a little to provide a useful language in
its own right? The gap is still much, much smaller than that between
C++ and C, for example.
Best,
Martin
More information about the Cython-dev
mailing list