Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Python 3.3 Offers Improved Performance, Bug Fixes, and New Features Galore

DZone's Guide to

Python 3.3 Offers Improved Performance, Bug Fixes, and New Features Galore

· Web Dev Zone ·
Free Resource

Bugsnag monitors application stability, so you can make data-driven decisions on whether you should be building new features, or fixing bugs. Learn more.

Python 3.3 alpha 1 is here, and as you would expect, this latest update offers bug fixes and new features galore.  Previously a source of great frustration for many developers, Python users will be happy to hear that Python 3.3 offers a new memoryview implementation, featuring a PEP-3118 compliant getbufferproc():


The new memoryview implementation comprehensively fixes all ownership and lifetime issues of dynamically allocated fields in the Py_buffer struct that led to multiple crash reports.  Additionally, several functions that crashed or returned incorrect results for non-contiguous or multi-dimensional input have been fixed.

-- Python.org


There are also some major performance improvements, thanks to PEP 393, which changed the Unicode string type to support multiple internal representations, allowing for space-efficient representation in most cases, while still providing access to full UCS-4 on all systems.


Other changes thanks to PEP 393 include:

  • Provides full support of all Unicode code points, including non-BMP ones.
  • Eliminates narrow builds, even in Windows, and thereby eliminates narrow build-specific problems.

The following features are also new to Python 3.3:

  • All native single character format specifiers in struct module syntax (optionally prefixed with '@') are now supported.
  • Multi-dimensional list representations are supported for any array type.
  • All array types are hash able if the exporting object is hash able and the view is read-only.
  • API Changes
    • The maximum number of dimensions is officially limited to 64.
    • The representation of empty shape, strides, and sub offsets is now an empty tuple instead of None.
-- Python.org


Other interesting improvements:

PEP 3151: Reworking the OS and IO Exception Hierarchy - exception types have been condensed down to one: OSError, while other exceptions have been kept as aliases for compatibility reasons.

PEP 409: Suppressing Exception Context - disables the display of the chained exception context, providing better error messages.


There is also a long list of New and Improved Modules for Python 3.3 you can browse through here.

Monitor application stability with Bugsnag to decide if your engineering team should be building new features on your roadmap or fixing bugs to stabilize your application.Try it free.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}