[EMAIL PROTECTED] wrote:
>
> I've been thinking about this some more (in lieu of actually writing up any
> sort of proposal ;-) and I'm not so sure it would be all that useful. If
> you've opened a file in text mode you should only be writing newlines as
> '\n' anyway. If you want to translate a text file imported from another
> system to use the current system's line ending just open both the input and
> output files in text mode.
I.e. at least \r, \f and \v are discouraged - i.e. system-dependent,
at best. That works.
> With universal newlines mode for output, should writing '\r\n' result in one
> or two newlines (or one-and-a-half)? Depending on the platform you can
> argue that it should write out '\r\r', '\r\n\r\n' or '\n\n' or if on Windows
> that it should be left alone as '\r\n'. There is, of course, the current
> '\r\r\n' behavior as well. I don't think there's obviously one best answer.
Quite. And it has nothing to do with the format the outside system
uses - your first question is purely a matter of what the semantics
of the Python program are. The question applies as much to zOS as
to any of the systems Python supports.
> If you want to do something esoteric, open the file in binary mode and do
> whatever you like.
Er, no. That's the Unix mistake. It works, provided two things are
true:
1) You don't need to write portable formatting.
2) The 'outside system' uses the control characters of a byte
stream for formatting.
Let's skip (1) - but (2) is universally true, nowadays, isn't it?
Er, no. Consider reading and writing to an X window (NOT an xterm).
Such formatting is out-of-band (sorry, I used out-of-bound in a
previous posting).
Ouch.
Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email: [EMAIL PROTECTED]
Tel.: +44 1223 334761 Fax: +44 1223 334679
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com