On 8/14/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > I thought some more about the universal newlines situation, and I > think I can handle all the use cases with a single 'newline' > parameter. The use cases are: > > (A) input use cases: > > (1) newline=None: input with default universal newlines mode; lines > may end in \r, \n, or \r\n, and these are translated to \n. > > (2) newline='': input with untranslated universal newlines mode; lines > may end in \r, \n, or \r\n, and these are returned untranslated. > > (3) newline='\r', newline='\n', newline='\r\n': input lines must end > with the given character(s), and these are translated to \n. > > (B) output use cases: > > (1) newline=None: every \n written is translated to os.linesep. > > (2) newline='': no translation takes place. > > (3) newline='\r', newline='\n', newline='\r\n': every \n written is > translated to the value of newline. >
I like the options, but I would swap the meaning of None and the empty string. My reasoning for this is that for option 3 it says to me "here is a string representing EOL, and make it \n". So I would think of the empty string as, "I don't know what EOL is, but I want it translated to \n". Then None means, "I don't want any translation done" by the fact that the argument is not a string. In other words, the existence of a string argument means you want EOL translated to \n, and the specific value of 'newline' specifying how to determine what EOL is. -Brett _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com