[issue13997] Add open_ascii() builtin

2012-02-11 Thread Nick Coghlan
Nick Coghlan added the comment: Pondering it further (and reading subsequent comments here and in the thread), I agree an open_ascii() builtin would be a step backwards, not forwards. So, morphing this issue into a documentation one to work out: - the bare minimum we think Python 3 users shoul

[issue13997] Add open_ascii() builtin

2012-02-11 Thread Éric Araujo
Éric Araujo added the comment: IMO it is a fact that the characters used by human languages are stored as bytes by computers, so a programmer needs to know the basics about text handling and encoding. I don’t like the idea of a built-in function helping people to put their hands on their ear

[issue13997] Add open_ascii() builtin

2012-02-11 Thread Nick Coghlan
Nick Coghlan added the comment: No point to adding a new keyword arg - if people are going to do something like that, they may as well learn to use "errors" and "encoding" properly. Adding open_ascii() would be an acknowledgement that "basically ASCII, but maybe with a few other bytes that ju

[issue13997] Add open_ascii() builtin

2012-02-11 Thread Chris Rebert
Chris Rebert added the comment: @Bendersky: Unlike open()'s other arguments, that one wouldn't be orthogonal though. It would be possible to write e.g.: f = open(fname, encoding="big5", errors="replace", ascii_only=True) which seems disturbing, IMO. It would be nicer to rule out such impossi

[issue13997] Add open_ascii() builtin

2012-02-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: Hmm, what happened to "not every one-liner should be a builtin function"? > I'm only manipulating the ASCII parts How can you be sure about that? > It would be significantly more friendly to beginners (and migrants from > Python 2) To the point that many of

[issue13997] Add open_ascii() builtin

2012-02-11 Thread Eli Bendersky
Eli Bendersky added the comment: Would not adding a new keyword arg to open() be less intrusive and more consistent? I.e. open(fname, asciionly=True) or something similar. -- nosy: +eli.bendersky ___ Python tracker

[issue13997] Add open_ascii() builtin

2012-02-11 Thread Chris Rebert
Changes by Chris Rebert : -- nosy: +cvrebert ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue13997] Add open_ascii() builtin

2012-02-11 Thread Nick Coghlan
New submission from Nick Coghlan : (This proposes a new builtin, so may need to become a PEP) A common programming task is "I want to process this text file, I know it's in an ASCII compatible encoding, I don't know which one specifically, but I'm only manipulating the ASCII parts so it doesn'