News for hackers. Stuff that matters.
Re:Why Python 3 Exists by bronson on Thursday December 17, 2015 @03:21PM (#10754228)
"\x01\x02".encode('zlib') is a really odd API. Just making sure: this is a real thing, and you're in favor of it?
Re:Why Python 3 Exists by tveita on Friday December 18, 2015 @07:35AM (#10758102)
It is in Python 2, but not in Python 3, where str.encode() and bytes.decode() have been restricted to only convert between strings and bytes.

    >>> "foo".encode('zlib')
    LookupError: 'zlib' is not a text encoding; use codecs.encode() to handle arbitrary codecs
Re:Why Python 3 Exists by the_mitsuhiko on Thursday December 17, 2015 @03:54PM (#10754473)
> "\x01\x02".encode('zlib') is a really odd API. Just making sure: this is a real thing, and you're in favor of it?

Of course this is a real thing and it's very frequently used. Yes I am in favour of it as the codec system in Python is precisely the place where things like this should live.