Python 3.3 Offers Improved Performance, Bug Fixes, and New Features Galore
The Web Dev Zone is brought to you in partnership with Mendix. Discover how IT departments looking for ways to keep up with demand for business apps has caused a new breed of developers to surface - the Rapid Application Developer.
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.
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.
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.