[Cython] Class scope lookup order
Vitja Makarov
vitja.makarov at gmail.com
Mon Aug 15 07:45:52 CEST 2011
When creating python-class dict it seems that CPython first looks at
dict then at globals:
A = 1
class X:
A = A
def y():
A = 3
class Y:
A = A
return Y
Y = y()
print(X.A, Y.A)
Will print: 1, 1
And not: 1, 3
I didn't find documentation for this but if I'm correct that should be
easy to fix issue in Cython.
Now for this code cython reports compile-time error: local variable
referenced before assignment
--
vitja.
More information about the cython-devel
mailing list