[Python-Dev] Proposal for new core module: UserFIle

Skip Montanaro skip at pobox.com
Thu Dec 11 17:24:34 EST 2003


    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?

    Keith>      """MergedIO(outfile, infile)
    Keith> Combines a write stream and a read stream into one read/write
    Keith> object.""" 

And isn't this subsumed by mode='r+'?

Skip



More information about the Python-Dev mailing list