Chris has been married to the love of his life, Danielle, for over four years now and they recently had their first child, their daughter Helena. Chris was an expert wrangler of developer content for DZone, but recently started creating marketing content for DZone and AnswerHub. If you're looking for someone to bore you to death with endless football knowledge, Chris is your go-to-guy! Chris is a DZone employee and has posted 275 posts at DZone. You can read more from them at their website. View Full User Profile

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

03.05.2012
| 4651 views |
  • submit to reddit
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.
Tags: