[Pyrex] Pyrex idioms and optimizations?
Stefan Behnel
stefan_ml at behnel.de
Wed Jul 25 08:19:23 CEST 2007
William Stein wrote:
> 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.
But this is different from
c = 10
def foo(a,b):
print a + b + c
right? Or do you require the "global" statement in that case? I think my
example is definitely a valid use of Pyrex. How do you do that anyway? Do you
check the __builtins__ at compile time? That would be the wrong thing to do.
Stefan
More information about the Pyrex
mailing list