question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compatibility with variable annotations (PEP 526)

See original GitHub issue

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:

Error compiling Cython file:
------------------------------------------------------------
...
n: int = 10
^
------------------------------------------------------------

test.pyx:1:1: Syntax error in simple statement list

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
mjoscommented, Sep 7, 2017

Sorry for my late reply. Works like a charm! Thanks a lot.

1reaction
scodercommented, Sep 2, 2017

Implemented in latest master. Could you please give it a try?

Read more comments on GitHub >

github_iconTop Results From Across the Web

PEP 526 – Syntax for Variable Annotations
Type annotations should not be confused with variable declarations in statically typed languages. The goal of annotation syntax is to provide an easy...
Read more >
Support Python 3.6 PEP 526 Syntax for Variable Annotations
It seems that the PEP 526 will be implemented in Python 3.6: any variable name and assignment can be annotated with typing hints...
Read more >
Add support for Variable Annotations (PEP 526) (#2706) · Issues ...
Created originally on Bitbucket by Kentzo Python 3.6 allows to annotate variables. PyPy should support new syntax for code compatibility.
Read more >
Try to understand "Class and instance variable annotations" in ...
It seems to me that I misunderstand the PEP 526 in the context of annotating class and instance variables. Based on the example...
Read more >
[Python-Dev] Please reject or postpone PEP 526
it states that "Variable annotations have already been around for almost two years in the form of type comments, sanctioned by PEP 484."...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found