On 01/12/2014 07:45 PM, Guido van Rossum wrote: > On Sun, Jan 12, 2014 at 6:16 PM, Ethan Furman <ethan at stoneleaf.us> wrote: >> In reference to a byte stream, if you do: >> >> --> b'%s' % 'some text'.encode('cp1241') >> >> it's really just bytes into bytes. > > That's a confusing example -- it would be clearer to just show > > b'%s' % b'some text' > >> If you do : >> >> --> b'%s' % 'some text' >> >> then the encoding is ASCII with strict error checking. So if it's not >> representable as clean ASCII either encode it manually, or prepare for it to >> blow up with an UnicodeEncodeError. > > You don't say what outcome you want, but if you wanted b'%s' % 'some > text' to return b'some text' while b'%s' % '\u1234' should blow up, > you're back at the Python 2 approach and that is the last thing I > want. Fair enough. I'm cool with getting back b"'some_text'" and not ever blowing up. -- ~Ethan~
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