Dag Sverre Seljebotn, 22.03.2010 20:01: > I think there should be a decorator though: > > @cython.compile # or whatever > def foo(x: cython.int) -> cython.int > > which has the behaviour that in pure Python mode the argument decorators > are stripped away (or perhaps stuck into an attribute on the function > instead). Since decorated arguments don't have a meaning in themselves, > I think it is polite to somehow declare their intent.
I don't think that should be required. In pure mode, "import cython" makes Cython declarations available in the module namespace, so using them in a function signature is a rather clear expression of intention when the module is passed into the Cython compiler. Note that annotations are available through introspection, and I think they should stay visible from Python space after compilation. However, we might want to extend the annotations somewhat to allow semantics like "list but not None", as we do in Cython code. Maybe something like "l: cython.notnone(list)" or "l: cython.declare(list, not_none=True)". IIRC, the PEP suggests the use of tuples to provide multiple annotations. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
