[Pyrex] Pyrex idioms and optimizations?

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Jul 26 14:23:01 CEST 2007


Lenard Lindstrom wrote:
> But Pyrex has a bug:
> 
>  >>> import foo
>  >>> foo.c = 12
>  >>> foo.foo(1, 2)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "foo.pyx", line 2, in foo.foo
>     print a + b + c
> NameError: c

It's not a bug, it's a feature. :-)

I made a deliberate decision to depart from Python semantics
here because I didn't want the overhead of looking up every
global reference up to twice. So it makes a static decision
about whether a global is module-level or builtin.

--
Greg



More information about the Pyrex mailing list