Vitja Makarov, 08.03.2011 11:01:
Hi!Here is example code: def foo(seq): cdef int x return any(x for x in seq) Here inner x have type int, how does cdef affects nested scope? Is that correct?
Yes, that's intended. Otherwise there'd be no way to assign types to variables used in genexpr/comprehension scopes.
The rule is: if there is a variable of the same name cdef-ed in the outer scope, inherit its type.
Arguably, this leaves a dangling unused variable in the outer scope, but I find that a minor issue compared to the problem of declaring a type for the inner scope.
Stefan _______________________________________________ cython-devel mailing list [email protected] http://mail.python.org/mailman/listinfo/cython-devel
