Just van Rossum wrote: > My preference for bytes -> unicode -> bytes API would be this: > > u = unicode(b, "utf8") # just like we have now > b = u.tobytes("utf8") # like u.encode(), but being explicit > # about the resulting type +1 - I was going to write exactly the same thing. The `bytes` type shouldn't know anything about unicode - conversions between bytes and unicode is entirely the responsibility of the unicode type. Alternatively, rather than as part of the constructor (though that seems the obvious place) some people may prefer a classmethod: unicode.frombytes(cls, encoding) It gives a nice symmetry. Tim Delaney
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4