On 8/15/07, Christian Heimes <[EMAIL PROTECTED]> wrote:
> Brett Cannon wrote:
> > 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.
>
> I like to propose some constants which should be used instead of the
> strings:
>
> MAC = '\r'
> UNIX = '\n'
> WINDOWS = '\r\n'
> UNIVERSAL = ''
> NOTRANSLATE = None
>
> I think that open(filename, newline=io.UNIVERSAL) or open(filename,
> newline=io.WINDOWS) is much more readable than open(filename,
> newline=''). Besides I always forget if Windows is '\r\n' or '\n\r'. *g*

I agree, but please make the constants opaque.  I don't want to see a
random mix of constants and non-constants.  Plus, opaque constants
could be self-documenting.

-- 
Adam Olsen, aka Rhamphoryncus
_______________________________________________
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

Reply via email to