aurora wrote:
> [...]
In Java they are distinct data type and the compiler would catch all incorrect usage. In Python, the interpreter seems to 'help' us to promote binary string to unicode. Things works fine, unit tests pass, all until the first non-ASCII characters come in and then the program breaks.
Is there a scheme for Python developer to use so that they are safe from incorrect mixing?
Put the following:
import sys sys.setdefaultencoding("undefined")
in a file named sitecustomize.py somewhere in your Python path and Python will complain whenever there's an implicit conversion between str and unicode.
HTH, Walter Dörwald -- http://mail.python.org/mailman/listinfo/python-list