4 ms·
This is what Python should have done.
by peterkelly 5y ago
This is what Python should have done.
- egeozcan 5y agoJavaScript had something close, valid on the context level, with "use strict" (which is, I guess, borrowed from Perl), and I still don't understand why they don't repeat that for newer features that would be much simpler if they broke backwards compatibility.
- winstonewert 5y agoThis approach only works for syntax level changes, it wouldn't have helped the problematic changes in Python 2 -> 3.
- cyphar 5y agoWell, the ability to specify python version by module would've made migration much easier for everyone (in theory). But you're quite right that it wouldn't by itself be a solution -- it would also have required additional complexity to handle interoperability when calling between python versions, both in the runtime and the programs themselves (even a sufficiently smart compiler can't figure out what string encoding a python2 function expects).