History of Python: Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Removed parameters. | Use this bot. Report bugs. | #UCB_CommandLine
Line 63:
 
===Compatibility===
Python 3.0 broke backward compatibility, and much Python 2 code does not run unmodified on Python 3.<ref>{{Cite web |title=PEP 3000 – Python 3000 {{!}} peps.python.org |url=https://peps.python.org/pep-3000/#compatibility-and-transition |access-date=2022-06-02 |website=peps.python.org |archive-date=April 2, 2022 |archive-url=https://web.archive.org/web/20220402165138/https://peps.python.org/pep-3000/#compatibility-and-transition |url-status=live}}</ref> Python's [[dynamic typing]] combined with the plans to change the semantics of certain methods of dictionaries, for example, made perfect [[source-to-source compiler|mechanical translation]] from Python 2.x to Python 3.0 very difficult. A tool called "2to3" does the parts of translation that can be done automatically. At this, 2to3 appeared to be fairly successful, though an early review noted that there were aspects of translation that such a tool would never be able to handle.<ref>{{Cite web |last=Ruby |first=Sam |date=September 1, 2007 |title=2to3 |url=https://intertwingly.net/blog/2007/09/01/2to3 |url-status=live |archive-url=https://web.archive.org/web/20160324182701/https://intertwingly.net/blog/2007/09/01/2to3 |archive-date=March 24, 2016 |access-date=2024-09-06 |website=intertwingly.net}}</ref> Prior to the roll-out of Python 3, projects requiring compatibility with both the 2.x and 3.x series were recommended to have one source (for the 2.x series), and produce releases for the Python 3.x platform using 2to3. Edits to the Python 3.x code were discouraged for so long as the code needed to run on Python 2.x.<ref name="pep-3000" /> This is no longer recommended; as of 2012 the preferred approach was to create a single code base that can run under both Python 2 and 3 using compatibility modules.<ref>{{Cite web |last=Coghlan |first=Alyssa |date=April 21, 2020 |title=Python 3 Q & A – Alyssa Coghlan's Python Notes |url=https://python-notes.curiousefficiency.org/en/latest/python3/questions_and_answers.html#other-changes |url-status=live |access-date=2024-09-06 |website=python-notes.curiousefficiency.org}}</ref>
 
===Features===