[Pyrex] Pyrex idioms and optimizations?

William Stein wstein at gmail.com
Wed Jul 25 07:37:55 CEST 2007


On 7/24/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> William Stein wrote:
> > However, there is legal Pyrex code that won't compile in SageX (since
> > we think it shouldn't be legal), and of course vice versa.
>
> Is this because you think it shouldn't be legal in
> Pyrex generally, or because it conflicts with some
> Sage-specific feature?
>


A year ago I didn't know whether SageX would do anything
at all that would be SAGE-specific, but so far after a year
there is nothing in SageX that is SAGE-specific.

Something that is valid in Pyrex but we think should not
be valid is the following:

# This is a complete file:
################

def foo(a,b):
   print a + b + c

################

In Pyrex it compiles fine.  In SageX it gives an error
message that c is not defined.  This avoids countless
runtime errors.

An example of code that is valid in SageX but not in Pyrex
is:

return [i*i for i in range(10)]

since Pyrex doesn't support list comprehensions.
Another example is

cdef int n = 5

which is valid in SageX but not Pyrex.



More information about the Pyrex mailing list