[Twisted-Python] Twisted 16.6.0rc1 Release Candidate Announcement

Tristan Seligmann mithrandi at mithrandi.net
Tue Nov 22 16:26:27 MST 2016


On Wed, 23 Nov 2016 at 01:14 Tristan Seligmann <mithrandi at mithrandi.net>
wrote:

> On Tue, 22 Nov 2016 at 23:37 Glyph Lefkowitz <glyph at twistedmatrix.com>
> wrote:
>
>
> This is the part that I'm worried about.  It kinda seems like we're moving
> toward "native string" being the type used in IRCClient, and *that* is
> capital-W Wrong.  Native strings are for Python-native types only, i.e.
> docstrings and method names.
>
>
> Unless I'm misunderstanding, we're not "moving towards" it, we have *already
> arrived*: IRCClient deals in str (bytes) on Python 2, and str (unicode)
> on Python 3. Even if we want a unicode API, having it only exist on Python
> 3 seems incredibly confusing from a user standpoint, and would appear to
> require some absurd contortions to write client code that behaves
> approximately the same on both Python 2 and 3.
>

For example, as far as I can tell, the only way to write code to join a
channel named #tëst (UTF-8 encoded) is:

channel = u'#tëst'
if PY3:
    channel = channel.encode('utf-8')
client.join(channel)

On Python 3, client.join(b'#t\xc3\xab') will try to send JOIN b'#t\xc3\xab',
which is garbage, whereas on Python 2, client.join(u'#t\xebst') will
produce a UnicodeEncodeError.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20161122/086290aa/attachment-0002.html>


More information about the Twisted-Python mailing list