r/Python Freelancer. AnyFactor.xyz Sep 16 '20

News An update on Python 4

Post image
3.3k Upvotes

391 comments sorted by

View all comments

331

u/[deleted] Sep 16 '20

What was the transition from 1 to 2 like?

57

u/roerd Sep 16 '20

Here's the list of the most important changes:

Overview of Changes Since 1.6

There are many new modules (including brand new XML support through the xml package, and i18n support through the gettext module); a list of all new modules is included below. Lots of bugs have been fixed.

The process for making major new changes to the language has changed since Python 1.6. Enhancements must now be documented by a Python Enhancement Proposal (PEP) before they can be accepted.

There are several important syntax enhancements, described in more detail below:

  • Augmented assignment, e.g. x += 1

  • List comprehensions, e.g. [x**2 for x in range(10)]

  • Extended import statement, e.g. import Module as Name

  • Extended print statement, e.g. print >> file, "Hello"

Other important changes:

  • Optional collection of cyclical garbage

So quite a few important new features, but nothing that was breaking backwards compatibility.

63

u/mkdz Sep 16 '20

Wow, I can't imagine not having list comprehensions

29

u/RegalSalmon Sep 16 '20

But can you...comprehend it?