[Python-Dev] Proposal for new core module: UserFIle (original) (raw)
Brett C. bac at OCF.Berkeley.EDU
Thu Dec 11 17:51:32 EST 2003
- Previous message: [Python-Dev] Proposal for new core module: UserFIle
- Next message: [Python-Dev] Proposal for new core module: UserFIle
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Keith Dart wrote:
On Thu, 2003-12-11 at 14:24, Skip Montanaro wrote:
Keith> class TextFile(UserFile): Keith> """TextFile(self, name, mode="r", bufsize=-1, linesep=None) Keith> A file object that handles different line separator Keith> conventions. This file object's readline() method returns the Keith> line with trailing line separator stripped, and raises EOFError Keith> on end of file. The writelines() method will append an Keith> appropriate line separator when writing. Thus, this file object Keith> allows reading and writeing non-native text files. Keith> """
Is there a reason the universal newline mode doesn't cover this case already? This module lets you explicitly create a text data file for any platform. The universal newline feature of python is for Python modules only, and lets you transparently import and exec Python source files with the different line ending formats. That is a different thing.
Not true. Python 2.3 added the "U" option for file opening to use universal newline support for any file you open. See http://www.python.org/doc/2.3/whatsnew/node7.html .
-Brett
- Previous message: [Python-Dev] Proposal for new core module: UserFIle
- Next message: [Python-Dev] Proposal for new core module: UserFIle
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]