3 ms·
I don't get it. When Py4 comes in sight they'll fix it probably so `six.PY3` is only True when using a Python3 interpreter and I guess they'll introduce a viari
by OrangeTux 11y ago
I don't get it. When Py4 comes in sight they'll fix it probably so `six.PY3` is only True when using a Python3 interpreter and I guess they'll introduce a viariable `six.PY4`.
- krallja 11y agoThat is exactly the problem. Code that assumes `not six.PY3` means Python 2 will start breaking.
- tgb 11y agoYou misread the article (six.PY3 is already like that).
- ergothus 11y agoThat's the point...if the code says "If Py3, do (modern code) else do (old code)", then when/if py4 comes out, and six.PY3 is False, you end up running (old code). Obviously you don't know if (modern code) is Py4 compatible, since we don't know what py4 is, but while the py3 code MIGHT be runnable under py4, the py2 code is ALMOST CERTAINLY not going to run under py4. So instead, make the check for PY2 code: If Py2 do (old code), else do (modern code). That MIGHT break under Py4, if modern code isn't future code, but also MIGHT work, whereas the other version WOULD break under Py4. Same story if you're using sys.version[] rather than six.