Adam Forsyth

I'm an Engineering and Community Lead @ Braintree. At work I do a variety of things from technical architecture and planning to facilitating conference and event sponsorships. Outside of work, I'm coding enthusiast and frequent traveler, splitting my time between the city and the Great North Woods. Find me online or at local Python events in either Chicago or Burlington, VT.

What's Coming in 3.8? Assignment Expressions & More!

Python & Libraries, Beginner
8/17/2019 | 11:05 AM-11:35 AM | Robertson

Description

Curious what's coming next for Python? Well, Python 3.8 is being released just a few short months. It already includes a number of new features such as assignment expressions, improved debugging, more string formatting features, and many smaller changes. Come learn about the big ones and some of the more interesting small ones too!

Abstract

I'll start out with the major new features and their PEPs (listed below, but also including any more added before the talk):

Assignment expressions

There is new syntax (the “walrus operator”, :=) to assign values to variables as part of an expression.

Positional-only parameters

There is new syntax (/) to indicate that some function parameters must be specified positionally (i.e., cannot be used as keyword arguments).

Parallel filesystem cache for compiled bytecode files

The new PYTHONPYCACHEPREFIX setting (also available as -X pycache_prefix) configures the implicit bytecode cache to use a separate parallel filesystem tree, rather than the default pycache subdirectories within each source directory.

Debug build uses the same ABI as release build

Python now uses the same ABI whether it built in release or debug mode. On Unix, when Python is built in debug mode, it is now possible to load C extensions built in release mode and C extensions built using the stable ABI.

f-strings now support = for quick and easy debugging

Add = specifier to f-strings. f'{expr=}' expands to the text of the expression, an equal sign, then the repr of the evaluated expression. So:

Then I'll talk about a few of the smaller features such as continue inside finally, iterable unpacking in yield and return, new SyntaxWarnings, etc.