[Pyrex] Pyrex idioms and optimizations?

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


Greg Ewing wrote:
> 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.
>
>   
Ok. I see it is documented under "scope rules". I apologize.

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




More information about the Pyrex mailing list