On 01/12/2014 07:45 PM, Guido van Rossum wrote:
On Sun, Jan 12, 2014 at 6:16 PM, Ethan Furman <et...@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~
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to