3 ms·
Please elaborate. Which feature of Python 3 would be impossible to implement in Python 2? Note that Python 3 code is not guaranteed to work in Python 4, but you
by Grue3 11y ago
Please elaborate. Which feature of Python 3 would be impossible to implement in Python 2? Note that Python 3 code is not guaranteed to work in Python 4, but you are guaranteed to (relatively) painlessly port it, since all Python 3 features are implemented in Python 4 in some way.
- verbatim 11y agoPick a Python 3 feature and let us know how you would implement it in Python 2.
- Grue3 11y agoEasy. Feature: print function. Implementation: from __future__ import print_function Yes, that magical, backwards-incompatible, print function has been in Python 2 all along! Feature: unicode strings Implementation: from __future__ import unicode_literals Amazing! The magical, backwards-incompatible unicode strings backported to Python 2 with one single line. I could go on and on.
- orf 11y ago> Amazing! The magical, backwards-incompatible unicode strings backported to Python 2 with one single line. Except it's not even slightly close to that is it. unicode_literals is something completely different. How about removing old style classes? Is `class x:` old style or new style in Python 2, in this imaginary interpreter of yours? How about the default object comparison being sane in Python 3. How about the changes to builtins returning iterables over lists? How about the import system being more sane? How about removing backticks? How about actually handling the unicode differences? I could go on and on, and I hope your answer is not 'well we just need more __future__ imports don't we'.
- takeda 11y agoPython is Turing Complete, so everything you can do in Py3 you can do in Py2, but so you can also implement in Brainfuck. The question is whether programming in one version vs the other is more enjoyable.