[issue17437] Difference between open and codecs.open

New submission from Giampaolo Rodola': In Python 2 the distinction between open() and codes.open() was clear because 'encoding' and 'errors' args were provided by codecs.open only. This is no longer the case in Python 3 since both args are provided also by open(). I'm probably missing something but regardless I think codecs.open doc [1] should be more clear as to when and why (say) codecs.open(file, encoding='utf8', errors='ignore') should be preferred over open(file, encoding='utf8', errors='ignore'). [1] http://docs.python.org/3/library/codecs.html#codecs.open ---------- assignee: docs@python components: Documentation messages: 184303 nosy: docs@python, ezio.melotti, giampaolo.rodola priority: normal severity: normal status: open title: Difference between open and codecs.open versions: Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue17437> _______________________________________

STINNER Victor added the comment: See also the PEP 400. I proposed (in the alternative) to make codecs.open() somehow an alias to open() (and add codecs.open_stream() for "backward compatibility"). ---------- nosy: +haypo _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue17437> _______________________________________

Change by Irit Katriel <iritkatriel@yahoo.com>: ---------- versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue17437> _______________________________________
participants (3)
-
Giampaolo Rodola'
-
Irit Katriel
-
STINNER Victor