[Python-Dev] peps: And now for something completely different. (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Sun Nov 13 22:47:26 CET 2011


On Sun, 13 Nov 2011 22:33:28 +0100 barry.warsaw <python-checkins at python.org> wrote:

+And Now For Something Completely Different +==========================================

So, is the release manager a man with two noses?

+Strings and bytes +----------------- + +Python 2's basic original string type are called 8-bit strings, and +they play a dual role in Python 2 as both ASCII text and as byte +arrays. While Python 2 also has a unicode string type, the +fundamental ambiguity of the core string type, coupled with Python 2's +default behavior of supporting automatic coercion from 8-bit strings +to unicodes when the two are combined, often leads to UnicodeErrors. +Python 3's standard string type is a unicode, and Python 3 adds a +bytes type, but critically, no automatic coercion between bytes and +unicodes is provided. Thus, the core interpreter, its I/O libraries, +module names, etc. are clear in their distinction between unicode +strings and bytes. This clarity is often a source of difficulty in +transitioning existing code to Python 3, because many third party +libraries and applications are themselves ambiguous in this +distinction. Once migrated though, most UnicodeErrors can be +eliminated.

First class unicode (*) support also makes Python much friendlier to non-ASCII natives when it comes to things like filesystem access or error reporting.

(*) even though Tom Christiansen would disagree, but perhaps we can settle on first and a half

+Imports +------- + +In Python 3, star imports (e.g. from x import *) are only +premitted in module level code.

permitted

Regards

Antoine.



More information about the Python-Dev mailing list