[Pyrex] C versus Python access

Robert Bradshaw robertwb at math.washington.edu
Wed Oct 31 07:42:58 CET 2007


On Oct 30, 2007, at 7:22 PM, David McNab wrote:

> On Tue, 2007-10-30 at 15:45 -0700, Robert Bradshaw wrote:
>
> Hi Robert,
>
> Thanks for switching me on. I'm trying out Cython - so far, so good. I
> could end up defecting for good.
>
> Is there an up-to-date list of the Cython/Pyrex differences  
> anywhere? I
> looked on the Cython website and wiki, but no such list jumped out at
> me.
>
> Are there any other goodies apart from cpdef?

I don't think this list is exhaustive, but what I can think of are:

- List Comprehensions
- in-place operators
- conditional expressions "x if b else y" (python 2.5)
- cdef inline
- assignment on declaration (e.g. "cdef int spam = 5")
- 'by' expression in for loop (e.g. "for i from 0 <= i < 10 by 2")
- boolean int type (e.g. it acts like a c int, but coerces to/from  
python as a boolean)
- improved error reporting (e.g. syntax error on non-existant builtin)
- many optimizations (e.g. list indexing, tuple unpacking, caching of  
builtin names and integer constants)

Some stuff that used to be new is now incorporated into Pyrex (e.g.  
using fast c/api functions rather than builtins for stuff like len,  
and importing c functions across modules.

You're right, this should be added to the Wiki.

- Robert




More information about the Pyrex mailing list