[Twisted-Python] Twisted for Python 3

Itamar Turner-Trauring itamar at itamarst.org
Wed Oct 19 09:36:59 MDT 2011


More generally, any place Twisted currently uses strings (i.e. byte
strings, as they all are in Python 2), the default should be bytes in
Python 3.x. When we switch to a minimum version of Python that has bytes
support we should start being more explicit about this and using the b""
syntax to emphasize this.

For example: Protocol.dataReceived, transport.write, protocol constants...
all should be bytes.

There are some places that probably should be unicode like FilePath,
although perhaps that's easier if we merge the unicode support branch.
There might be other places where a high-level API might choose to accept
unicode to make things easier (e.g. "GET" for web requests, as you said).
But in general, bytes should be the default because bytes is what network
programming is about.





More information about the Twisted-Python mailing list