[Python-ideas] Adding 'bytes' as alias for 'latin_1' codec.
Greg Ewing
greg.ewing at canterbury.ac.nz
Sat May 28 02:55:58 CEST 2011
Nick Coghlan wrote:
> The pedagogic cost of making it even harder than it already is to
> convince people that bytes are not text would also need to be
> considered.
I think that boat was missed some time ago. If there were
ever a serious intention to teach people that bytes are not
text by limiting the feature set of bytes, it would have
been better served by not giving bytes *any* features that
assumed a particular encoding.
As it is, bytes has quite a lot of features that implicitly
treat it as ascii-encoded text: the literal and repr()
forms, capitalize(), expandtabs(), lower(), splitlines(),
swapcase(), title(), upper(), and all the is*() methods.
Accepting all of that, and then saying "Oh, no, we couldn't
possibly provide a format() method, because bytes are not
text" seems a tad inconsistent.
--
Greg
More information about the Python-ideas
mailing list