On Sun, Jan 12, 2014 at 9:18 PM, Guido van Rossum <gu...@python.org> wrote: > On Sun, Jan 12, 2014 at 6:07 PM, Daniel Holth <dho...@gmail.com> wrote: >> Is there a formatting character that means "anything except a unicode >> string" to prevent accidentally interpolating a Unicode string into a >> bytes string without [a sane] encoding? > > No, and we shouldn't introduce one. An operation should either work > for no type, one type, a few specific types, or all types. Something > that works for all but one type will *appear* to work for all types to > a casually experimenting user and may pass extensive unittests, > leaving a bomb that can detonate when you least expect it.
That pretty much describes how I feel about str(bytes). I would accept "only a bytes" or "only a string" as consolation formatting characters :-) _______________________________________________ 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