[Pyrex] Pyrex idioms and optimizations?

Lenard Lindstrom len-l at telus.net
Thu Jul 26 17:40:13 CEST 2007


William Stein wrote:
>
> 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.
>
>   
Lets try again :-) :

But this is valid Pyrex, though not pretty. c is assumed to be builtin. 
It just needs a value assigned to it before foo is called:

 >>> import __builtin__
 >>> import foo
 >>> __builtin__.c = 12
 >>> foo.foo(1, 2)
15

-- 
Lenard Lindstrom
<len-l at telus.net>




More information about the Pyrex mailing list