[New-bugs-announce] [issue15204] Deprecate the 'U' open mode
report at bugs.python.org
Wed Jun 27 12:29:51 CEST 2012
New submission from Serhiy Storchaka <storchaka at gmail.com>:
Since Python 2.3 many open functions supports "Universal line mode" (PEP 278). Since 3.0 (and 2.6) PEP 3116 suggests better alternative -- io.TextWrapper.
Now support for the 'U' mode in the different open functions is heterogeneous. Some functions simply ignore the 'U' mode (but accept it), others perceive it as a synonym for text-mode, others just pass it on lower lever, other attempt to implement it, but the implementation is obtained imperfect and contradictory (as in ZipExtFile). The documentation for built-in open does not advise the use of the 'U' mode. The 'U' mode support cumbersome. I propose to deprecate the 'U' mode. If someone wanted to work with the universal line support, he'll surely need to work with encodings too, and io.TextWrapper provides is better choise.
The deprecation plan for the 'U' mode of open functions might be as follow:
3.3. Deprecating the 'U' mode in docs for all opens (building open, io.open, codecs.open, gzip.open, ZipFile.open, etc). Add suggestion about io.TextWrapper.
3.4. Raise a warning on use of the 'U' mode.
3.5. Raise an exception on use of the 'U' mode.
3.6 (or 4.0?). Remove the 'U' mode processing code.
As the first stage involves only the changes to the documentation, I hope deprecation can starts in 3.3.
assignee: docs at python
components: Documentation, IO, Library (Lib)
nosy: docs at python, storchaka
title: Deprecate the 'U' open mode
versions: Python 3.3
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce