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

Implement PEP 572: Assignment Expressions #2636

Open
scoder opened this Issue Sep 29, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@scoder
Contributor

scoder commented Sep 29, 2018

See https://www.python.org/dev/peps/pep-0572

For Cython, this has a couple of consequences:

  • The parser needs to be extended to support the new syntax.
  • Assignments can now happen inside of expressions, which was previously impossible. Several syntax tree transformations assume that they can stop at an ExprNode, which they cannot any more in the future.
  • The control flow analysis needs updating to detect assigned names in expressions and correctly track their usage.
  • An assignment expression would probably always move the assigned expression into a temp variable and continue from there. There may be expressions from that rule (for simple C types) since C also supports assignments in expressions, but that sounds more like an optimisation than a requirement.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment