Message106339
codecs module (and codecs.open() function) was added to Python 2.0. codecs.open() creates a StreamReaderWriter object which use two other objects: StreamReader and StreamWriter.
Python 2.6 and 3.0 have a new API: the io module. io.open() creates a TextIOWrapper object which is fully compatible with the file object API (it *is* the (text) file object API :-)). TextIOWrapper supports univeral newline and does better support reading+writing than StreamReaderWriter. TextIOWrapper has a better test suite and is used by default to read and write text files in Python3 (since Python 3.0). The io module has an *optimized* design and the io module was rewritten in C (in Python 2.7 and 3.1).
codecs.open() should be deprecated in Python 3.2 and removed in Python 3.3 (not in Python 2.7). Maybe also StreamReader, StreamWriter and StreamReaderWriter: I don't know if any program use directly these classes, but I think that TextIOWrapper can be used instead. |
|
Date |
User |
Action |
Args |
2010-05-23 19:27:55 | vstinner | set | recipients:
+ vstinner, pitrou |
2010-05-23 19:27:55 | vstinner | set | messageid: <1274642875.55.0.470910509558.issue8796@psf.upfronthosting.co.za> |
2010-05-23 19:27:53 | vstinner | link | issue8796 messages |
2010-05-23 19:27:52 | vstinner | create | |
|