4 ms·
In Python 4.0 (the one after 3.9), and in Python 3.7 now with "from __future__ import annotations", annotations are parsed but their interpolation is delayed. S
by 1st1 8y ago
In Python 4.0 (the one after 3.9), and in Python 3.7 now with "from __future__ import annotations", annotations are parsed but their interpolation is delayed. So you can literally have "var: 0 < var < 3" (annotation is not a string!) in your code and make it work as you wish.
- StavrosK 8y agoFYI, the Python version after 3.9 will be 3.10.
- ssebastianj 8y agoRelevant link: "PEP 563: Postponed Evaluation of Annotations" https://docs.python.org/3/whatsnew/3.7.html#pep-563-postponed-evaluation-of-annotations https://docs.python.org/3/whatsnew/3.7.html#pep-563-postpone...
- nerpderp83 8y agoIf your macro isn't changing execution semantics, it probably doesn't need to be a macro. This is why (if needs to be a special form if your language is eager, but you want to have short circuit conditionals. If you language is lazy, lots of things DON'T need to be macros.