[Python-ideas] PEP 540: Add a new UTF-8 mode

Barry Warsaw barry at python.org
Mon Jan 9 11:15:46 EST 2017


On Jan 06, 2017, at 11:08 PM, Steve Dower wrote:

>Passing universal_newlines will use whatever locale.getdefaultencoding()

There is no locale.getdefaultencoding(); I think you mean
locale.getpreferredencoding(False).  (See the "Changed in version 3.3" note in
$17.5.1.1 of the stdlib docs.)

>universal_newlines may become a bad choice if the default encoding no longer
>matches what the environment says, and personally, I wouldn't lose much sleep
>over that.

universal_newlines is also problematic because it's misnamed from the more
common motivation to use it.  Very often people do want to open std* in text
mode (and thus trade in Unicodes), but they rarely equate that to "universal
newlines".  So the option is just more hidden magical side-effect and
cargo-culted lore.  It's certainly *useful* though, and I think we want to be
sure that we don't break existing code that uses it for this purpose.

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170109/af2a910f/attachment.sig>


More information about the Python-ideas mailing list