Source

cpython_sandbox / Doc / whatsnew / 3.4.rst

What's New In Python 3.4

This article explains the new features in Python 3.4, compared to 3.3.

For full details, see the changelog.

Note

Prerelease users should be aware that this document is currently in draft form. It will be updated substantially as Python 3.4 moves towards release, so it's worth checking back even after reading earlier versions.

Summary -- Release highlights

New syntax features:

  • None yet.

New library modules:

  • None yet.

New built-in features:

  • None yet.

Implementation improvements:

Significantly Improved Library Modules:

Security improvements:

  • None yet.

Please read on for a comprehensive list of user-facing changes.

Other Language Changes

Some smaller changes made to the core Python language are:

  • Unicode database updated to UCD version 6.2.

New Modules

  • None yet.

Improved Modules

dis

The :mod:`dis` module is now built around an :class:`Instruction` class that provides details of individual bytecode operations and a :func:`get_instructions` iterator that emits the Instruction stream for a given piece of Python code. The various display tools in the :mod:`dis` module have been updated to be based on these new components.

The new :class:`dis.Bytecode` class provides an object-oriented API for inspecting bytecode, both in human-readable form and for iterating over instructions.

(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver in :issue:`11816`)

doctest

Added FAIL_FAST flag to halt test running as soon as the first failure is detected. (Contributed by R. David Murray and Daniel Urban in :issue:`16522`.)

smtplib

:exc:`~smtplib.SMTPException` is now a subclass of :exc:`OSError`, which allows both socket level errors and SMTP protocol level errors to be caught in one try/except statement by code that only cares whether or not an error occurred. (:issue:`2118`).

wave

The :meth:`~wave.getparams` method now returns a namedtuple rather than a plain tuple. (Contributed by Claudiu Popa in :issue:`17487`.)

Optimizations

Major performance enhancements have been added:

  • The UTF-32 decoder is now 3x to 4x faster.

Build and C API Changes

Changes to Python's build process and to the C API include:

  • None yet.

Deprecated

Unsupported Operating Systems

  • None yet.

Deprecated Python modules, functions and methods

Deprecated functions and types of the C API

  • None yet.

Deprecated features

  • None yet.

Porting to Python 3.4

This section lists previously described changes and other bugfixes that may require changes to your code.