Am 11.01.2014 14:49, schrieb Georg Brandl: > Am 11.01.2014 10:44, schrieb Stephen Hansen: > >> I mean, its not like the "bytes" type lacks knowledge of the subset of bytes >> that happen to be 7-bit ascii-compatible and can't perform text-ish >> operations >> on them-- >> >> Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:18:40) [MSC v.1600 32 >> bit >> (Intel)] on win32 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> b"stephen hansen".title() >> b'Stephen Hansen' >> >> How is this not a practical recognition that yes, while bytes are byte >> streams >> and not text, a huge subset of bytes are text-y, and as long as we maintain >> the >> barrier between higher characters and implicit conversion therein, we're >> fine? >> >> I don't see the difference here. There is a very real, practical need to >> interpolate bytes. This very real, practical need includes the very real >> recognition that converting 12345 to b'12345' is not something weird, >> unusual, >> and subject to the thorny issues of Encodings. It is not violating the >> doctrine >> of separation of powers between Text and Bytes. > > This. Exactly. Thanks for putting it so nicely, Stephen.
To elaborate: if the bytes type didn't have all this ASCII-aware functionality already, I think we would have (and be using) a dedicated "asciistr" type right now. But it has the functionality, and it's way too late to remove it. Georg _______________________________________________ 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