io.open 与在 python 中打开的区别

Difference between io.open vs open in python

过去,codecs 已被 io 取代。尽管使用 io.open 似乎更可取,但大多数介绍性的 python 类 仍然教导 open

Difference between open and codecs.open in Python 有一个问题,但是 open 的鸭子类型 io.open?

如果不是,为什么使用io.open更好?为什么用 open 教起来更容易?

在这个 post (http://code.activestate.com/lists/python-list/681909/) 中,Steven DAprano 说内置的 open 正在后端使用 io.open那么我们是否应该重构我们的代码以使用 open 而不是 io.open

除了 py2.x 的向后兼容性,还有什么理由在 py3.0 中使用 io.open 而不是 open 吗?

根据文档 Python3 中的情况:

io.open(file, *[options]*)

This is an alias for the builtin open() function.

While the builtin open() and the associated io module are the recommended approach for working with encoded text files, this module [i.e. codecs] provides additional utility functions and classes that allow the use of a wider range of codecs when working with binary files

(粗体和斜体是我的编辑)