4 ms·
Magic imports from __future__ are the usual way of turning on features in Python. The incompatibilities introduced in Python 3 weren't done that way to save on
by maxerickson 10y ago
Magic imports from __future__ are the usual way of turning on features in Python.
The incompatibilities introduced in Python 3 weren't done that way to save on implementation effort among other reasons.
- dorianm 10y agoMaybe python2 --enable-print-parentheses and other flags could have been useful to slowly detect future issues on python 2 code.
- maxerickson 10y agoPython 2.6 has from __future__ import print_function. There the saving of implementation effort would be not supporting print statements in 3.0.
- dorianm 10y agoNice it actually gives "SyntaxError: invalid syntax", but then it affects all the imported libraries so I still prefer the per-file way as a transition.
- ambivalence 10y ago__future__ imports are per file. A few posts up you were proposing an interpreter-wide switch. Did you change your mind?
- dorianm 10y agoAwesome. I think both are great, first doing file-per-file and once it's working switching the global switch is a pretty good transition workflow.