Code that will break in Python 4
41–50 of 237 posts
Re: Code that will break in Python 4
#42Re: Code that will break in Python 4
#43Often I discover projects that are still in v2, and no words about v3 on their roadmap. Maybe v4 should learn from JavaScript5 and Visual Basic 3-6. Support v2 syntax out of the box using a (slow) shim layer if there is no "use strict" in the first line. If that statement is present, don't load the shim layer and support only v4 syntax (faster). That way old v2 code would still work without any changes.
The syntax changes introduced in python 3 are easy to fix, and most of them are backwards compatible with python 2.7. The whole string/byte dichotomy, however, is a major change that I don't think any shim layer could handle correctly without major bugs, short of defining a whole new string-like class.
Re: Code that will break in Python 4
#44> In this case, no code will get executed on Python 4 at all! Maybe `import six` should trigger ImportError when imported on python 4. Only "eight" or "twelve" should support Python4. :)
2 x 3 = 6 => 2 x 3 x 4 = 24
;)
Re: Code that will break in Python 4
#45> In this case, no code will get executed on Python 4 at all! Maybe `import six` should trigger ImportError when imported on python 4. Only "eight" or "twelve" should support Python4. :)
Re: Code that will break in Python 4
#46> In this case, no code will get executed on Python 4 at all! Maybe `import six` should trigger ImportError when imported on python 4. Only "eight" or "twelve" should support Python4. :)
Re: Code that will break in Python 4
#47Re: Code that will break in Python 4
#48I 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`.