Python 3.8 introduces assignment expressions, described in PEP 572. Is there a way to test this new feature in Python 3.7.x?
In the past, new language features have been backported to earlier Python versions using __future__
imports.
__future__
import for assignment expressions?There is no __future__
import for assignment expressions in Python 3.7 – and adding one in a micro (or "bugfix") release is prohibited by PEP 6:
Bug fix releases are required to adhere to the following restrictions:
- There must be zero syntax changes. All .pyc and .pyo files must work (no regeneration needed) with all bugfix releases forked off from a major release.
The above prohibitions and not-quite-prohibitions apply both for a final release to a bugfix release (for instance, 2.4 to 2.4.1) and for one bugfix release to the next in a series (for instance 2.4.1 to 2.4.2).
Since assignment expressions constitute a change to the syntax of Python, there's no way they can be added to a future 3.7.x release of Python without breaking this prohibition.