First Python feature release under new governance model is here, complete with walrus operator (:=)

No word on eggman counterpart

It's a walrus

Python's new feature release – version 3.8 – has landed, the first since June 2018.

Python is the third most popular language in the Redmonk language rankings and fourth in the StackOverflow developer survey – second if you do not count HTML/CSS and SQL, behind JavaScript but ahead of Java.

The download page identifies 17 "major new features". One of these was so contentious that it resulted in a new governance model for the language.

This feature is Assignment Expressions (PEP 572), the ability to assign to variables within an expression by using := which is also known as the "walrus operator". Note that this is not about disambiguating between assignment and comparison, since Python already uses = for assignment and == for comparison. Rather, it allows assignment within an expression. Here is an example from the docs:

if (n := len(a)) > 10:
    print(f"List is too long ({n} elements, expected <= 10)")

PEP 572 was so hotly debated that in July 2018 Python author Guido van Rossum resigned his position as BDFL (Benevolent Dictator for Life). He said:

Now that PEP 572 is done, I don't ever want to have to fight so hard for a PEP and find that so many people despise my decisions.

I would like to remove myself entirely from the decision process. I'll still be there for a while as an ordinary core dev, and I'll still be available to mentor people – possibly more available. But I'm basically giving myself a permanent vacation from being BDFL, and you all will be on your own... I'm tired, and need a very long break.

The outcome was a new governance model for Python with a steering council, with Van Rossum being one of its members.

Other features in 3.8 include:

  • Ability to define parameters that must be positional (may not be assigned by keyword)
  • The same ABI (Application Binary Interface) in both release and debug mode
  • The continue statement is now valid in a finally block
  • A 40 per cent speed improvement in LOAD_GLOBAL, an opcode in Python bytecode

The full list of new features is here.

A landmark release then, not so much for its new features, but for being the first feature release to appear under the new governance model. ®

Sponsored: Beyond the Data Frontier

SUBSCRIBE TO OUR WEEKLY TECH NEWSLETTER




Biting the hand that feeds IT © 1998–2019