-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Aug 15, 2007, at 12:03 AM, Guido van Rossum wrote:
> On 8/14/07, Barry Warsaw <[EMAIL PROTECTED]> wrote: >> On Aug 14, 2007, at 12:52 PM, Guido van Rossum wrote: >>> On 8/14/07, Barry Warsaw <[EMAIL PROTECTED]> wrote: >>>> It would have been perfect, I think, if I could have opened the >>>> file >>>> in text mode so that read() gave me strings, with universal >>>> newlines >>>> and preservation of line endings (i.e. no translation to \n). >>> >>> You can do that already, by passing newline="\n" to the open() >>> function when using text mode. >> >> Cute, but obscure. I'm not sure I like it as the ultimate way of >> spelling these semantics. > > It was the best we could come up with in the 3 minutes we devoted to > this at PyCon when drafting PEP 3116. If you have a better idea, > please don't hide it! I think you (almost) suggested it in your first message! Add a flag called preserve_eols that defaults to False, is ignored unless universal newline mode is turned on, and when True, disables the replacement on input. >> There's still a problem though: this works for .readlines() but not >> for .read() which unconditionally converts \r\n to \n. The >> FeedParser uses .read() and I think the behavior should be the same >> for both methods. > > Ow, that's a bug! I'll look into fixing it; this was unintentional! Oh, excellent! I think that will nicely take care of email package's needs and will allow me to remove the crufty conversion. Thanks! - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) iQCVAwUBRsKCK3EjvBPtnXfVAQLgcgP/eFUci/jmPqEY5TDE1bUHgiMhY3F1GxXX epYc4Q7wDOf05Ky1pjmRDRMkfQkalL/seP58IAW7b1FaWT98bSP56vrLcyuy+oje 23e7bqggEikfS/+E15U7E/xz+h1qbKdEr7c43/sl/s8flBE47MHXAI/sMKKfvS+6 kVqHKWXX0Lk= =81z3 -----END PGP SIGNATURE----- _______________________________________________ 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