New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility with variable annotations (PEP 526) #1850
Comments
To allow Cython's various syntax changes, it has it's own parser which will need to be updated to handle those. Issue #1672 is also related. |
Not currently supported, but should be trivial to implement in the parser (and ignore it there for now).
|
@mjos: could you provide a set of tests for this feature? That would simplify the implementation. Just write a .py file to put into /tests/run/ that uses different variations of variable annotations, both at the module level and inside of functions. |
@scoder Sure, we will prepare something. Thanks. |
@scoder I have created variable_annotations.py with a buch of examples gathered quickly from the PEP 526. Is it ok like this (see the attachment)? |
Implemented in latest master. Could you please give it a try? |
Sorry for my late reply. Works like a charm! Thanks a lot. |
I'm really excited about the prospect of using standard python conventions for optional static typing for cython's purposes. This is a great first step towards it! I am wondering, could we also make this work for the case of
-->
The idea being that pure python mode completely specifies "all the things" that cython needs. |
Although, I am not sure how to use python's optional typing to specify the type of
|
Hi,
when trying to compile the following code:
n: int = 10
which uses PEP 526 style variable annotation (introduced in Python 3.6.0 beta 1) we get the following result from cython 0.26.1:
Is this a known limitation of cython that will be resolved in near future? Our code base uses a lot of variable annotations (helps documenting the code and refactoring) and this issue prevents us from using cython without code changes.
The text was updated successfully, but these errors were encountered: