Python 3.6

Python 3.6 will be the default Python 3 stack in Fedora 26. This is an upgrade from 3.5 which was included in Fedora 25. All packages which depend on Python 3 must be rebuilt. User-written Python 3 scripts and applications may require a small amount of porting; however, Python 3.5 is forward compatible with Python 3.6 for the most part.

Notable new features include:

  • Formatted string literals (f-strings): f"This will be evaluated to foo’s value: {foo}"

  • The order of elements in **kwargs: keyword arguments now preserve their order

  • The new secrets module provides handy helpers for secure token generation in various formats

  • Underscores in numeric literals let you break up magic constants to make them easier to read: 1_000_000

  • File system path protocol: Many more standard library APIs, including the builtin open(), now support pathlib.Path and pathlib.PurePath objects

  • A range of performance improvements.

For more detailed information see the Fedora Magazine announcement article or the upstream release notes. Note the Porting to Python 3.6 section, which lists important information for developers who need to port their Python 3.5 applications.

Python Classroom Lab

Fedora 26 brings in a new Python Classroom Lab. A variant of Fedora targeted at teachers and students of the Python programming langugae. A ready to use environment with Python, PyPy 3, virtualenv, tox, git, Jupyter Notebook and more. It’s ready in three variants: as a GNOME powered desktop or headless for Vagrant and Docker.

Find out more about the Python Classroom Lab on the Fedora Labs website.

Python 3 C.UTF-8 locale

An ongoing challenge within the Python 3 series has been determining a sensible default strategy for handling the “7-bit ASCII” text encoding assumption currently implied by the use of the default C locale.

Starting with Fedora 26, the Fedora system Python includes a backport of Python 3.7’s upcoming locale coercion feature, which means the Python 3 stack will automatically coerce the C locale to C.UTF-8 by setting the LC_CTYPE environment variable (if neither it nor LC_ALL are already set) before configuring the process locale. Automatically setting LC_CTYPE this way means that both the core interpreter and locale-aware C extensions (such as readline) will assume the use of UTF-8 as the default text encoding, rather than ASCII.

Full details of this new Python feature are contained in PEP 538 — Coercing the legacy C locale to a UTF-8 based local.