skip to navigation
skip to content

Not Logged In

encodingcontext 0.9.0

A bad idea about the default encoding

Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.

—Zen of Python

This small module implements a bad idea: making default encoding explicitly scoped:

>>> with encoding_context('euc-kr'):
...     str(u'\ud55c\uae00')
...
'\xc7\xd1\xb1\xdb'

Of course it has several shortcomings, and the most critical one is: using it within thread, threading, greenlet, tasklet, etc probably breaks its scoping. If Python had dynamic scoping and default encoding was defined as dynamically scoped variable, we might have more convenient way to code between Unicode--byte strings.

 
File Type Py Version Uploaded on Size
encodingcontext-0.9.0.tar.gz (md5) Source 2012-09-25 1KB
  • Downloads (All Versions):
  • 16 downloads in the last day
  • 66 downloads in the last week
  • 185 downloads in the last month