solipsis at pitrou.net
Mon Oct 3 20:43:34 EDT 2005
Le lundi 03 octobre 2005 à 18:19 -0600, Ken Kinder a écrit :
> 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")
This may seem surprising but it is logical.
If you design your network protocol properly, the design also includes
the details of how text is represented (including the encoding, how it
is specified, etc.).
So you can't ask Twisted to make a general decision for every network
protocol out there. Each protocol has its own view on the subject. It's
up to you to implement the design decision properly.
More information about the Twisted-Python