The above restrictions will most likely remain, since removing them would be difficult and they're not really needed for Pyrex's intended applications.Function definitions (whether using def or cdef) cannot be nested within other function definitions.
Class definitions can only appear at the top level of a module, not inside a function.
The import * form of import is not allowed anywhere (other forms of the import statement are fine, though).
Generators cannot be defined in Pyrex.
The globals() and locals() functions cannot be used.
There are also some temporary limitations, which may eventually be lifted, including:
Class and function definitions cannot be placed inside control structures.
List comprehensions are not yet supported.
There is no support for Unicode.
Special methods of extension types cannot have functioning docstrings.
The use of string literals as comments is not recommended at present, because they are not accepted in places where executable statements are not allowed.
will not work in Pyrex. This can be worked around by defining the function outside the class, and then assigning the result of classmethod or staticmethod inside the class, i.e.class Spam:def method(cls):
...method = classmethod(method)
def Spam_method(cls):
...class Spam:method = classmethod(Spam_method)