A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-June/112137.html below:

set the default encoding to 'utf-8' in Python 3.3?

[Python-Dev] open(): set the default encoding to 'utf-8' in Python 3.3? [Python-Dev] open(): set the default encoding to 'utf-8' in Python 3.3?Baptiste Carvello devel at baptiste-carvello.net
Wed Jun 29 09:21:19 CEST 2011
Le 28/06/2011 16:46, Paul Moore a écrit :
>
> -1. This will make things harder for simple scripts which are not
> intended to be cross-platform.
>
+1 to all you said.

I frequently use the python command prompt or "python -c" for various quick 
tasks (mostly on linux). I would hate to replace my ugly, but working

 >>> open('example.txt').read()

with the unnecessarily verbose

 >>> open('example.txt',encoding='utf-8').read()

When using python that way as a "swiss army knife", typing does matter.


My preferred solution would be:

>> - emit a warning if the encoding argument is not set

By the way, I just thought that for real programming, I would love to have a 
-Wcrossplatform command switch, which would warn for all unportable constructs 
in one go. That way, I don't have to remember which parts of 'os' wrap 
posix-only functionnality.

Baptiste

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4