[Twisted-Python] Unicode

Jp Calderone exarkun at divmod.com
Mon Oct 3 21:08:05 EDT 2005

On Mon, 03 Oct 2005 18:19:44 -0600, Ken Kinder <ken at kenkinder.com> wrote:
>Perhaps like many developers, I came across this surprising bit of code
>inside a couple of Twisted's methods:
>        if isinstance(data, unicode): # no, really, I mean it
>            raise TypeError("Data must be not be unicode")
> [snip]
>The purpose of Python's unicode type is transparent exchange of string
>objects, whether those string objects are of type str or type unicode.
>Pretending that isn't so and raising a TypeError is not helpful. I would
>urge you to AT LEAST provide a detailed explanation in that error,
>explaining the philosophical disagreement you have with Python's
>unicode-string conversion behavior and have a flag you can set to
>disable that check.

An explanation is more likely to be provided if there is a ticket for such.  If it's important to you, <http://www.twistedmatrix.com/bugs/>.  Thanks :)


More information about the Twisted-Python mailing list