On Mar 22, 2010, at 1:51 PM, Stefan Behnel wrote: > 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.
My thoughts as well, especially if you're using cython.int (rather than just int). > 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)". Sure. > IIRC, the PEP suggests the use of tuples to provide multiple > annotations. We should support that then. Supporting this (and other Py3 features) would make a great Py3 project (more so than generators, which would probably take a lot of background and familiarity with the code to get started on). Maybe making cython -3 (which use Py3 semantics), as discussed in a previous thread. Also, for anyone interested in working on Cython for GSoC, I would recommend finding a minor bug (e.g. on trac) and submitting a patch to get at least somewhat familiar with the codebase. - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
