I am pleased to announce the release of the Enthought Python Distribution version 7.0. This major release updates to Python 2.7, Intel Math Kernel Library 10.3.1, and NumPy 1.5.1. Updates to many other EPD packages are also included. Please find the complete list of additions, updates and bug-fixes in the changelog.
You can find more information about EPD and download a free 30-day trial here.
Python’s unicode documentation could use a little bit of love. It does a great job of discussing utf-8 support, but doesn’t really discuss any other codecs. Yesterday I found my self wondering what other codecs were supported & eventually found the codecs page. There are the usual, ‘utf-8’, ‘utf-16’, ‘latin-1’, etc., but at the bottom of the page is the bit that interested me.
Using the methods, “encode” and “decode”, which are meant to support unicode encoding, you’re capable of converting your data into all sorts of useful serializations. The 2 that piqued by interest the most are ‘base64’ and ‘zlib’.
Sometimes its useful to compress data being sent back and forth through a web session. When handling a request, you will want to base64, then unzip to decode the data
request_data = request.POST['data']
deserialization = request_data.decode('base64_codec').decode('zlib_codec')
Then when replying to the request, the data should be zipped, then base64 encoded
reply_data = '...'
serialization = reply_data.encode('zlib_codec').encode('base64_codec')
This example is rather contrived, and relies on under-documented features of python, but I thought it was pretty cool.
[edited to fix the sample code]