[Python-checkins] python/nondist/peps pep-0278.txt,1.6,1.7
jackjansen@sourceforge.net
jackjansen@sourceforge.net
Sat, 13 Apr 2002 15:16:51 -0700
Update of /cvsroot/python/python/nondist/peps
In directory usw-pr-cvs1:/tmp/cvs-serv28129
Modified Files:
pep-0278.txt
Log Message:
- Fixed a typo
- Return a tuple of newlines in stead of 'mixed'
- Added rationale for having the code in ifdefs and not having the
newlines attribute in --without-universal-newlines builds.
Index: pep-0278.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0278.txt,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** pep-0278.txt 11 Apr 2002 15:44:08 -0000 1.6
--- pep-0278.txt 13 Apr 2002 22:16:49 -0000 1.7
***************
*** 31,35 ****
Specification
! Universal newline support needs to be enabled by default,
but can be disabled during the configure of Python.
--- 31,35 ----
Specification
! Universal newline support is enabled by default,
but can be disabled during the configure of Python.
***************
*** 50,60 ****
There is no special support for output to file with a different
! newline convention.
A file object that has been opened in universal newline mode gets
a new attribute "newlines" which reflects the newline convention
used in the file. The value for this attribute is one of None (no
! newline read yet), "\r", "\n", "\r\n" or "mixed" (multiple
! different types of newlines seen).
--- 50,60 ----
There is no special support for output to file with a different
! newline convention, and so mode "wU" is also illegal.
A file object that has been opened in universal newline mode gets
a new attribute "newlines" which reflects the newline convention
used in the file. The value for this attribute is one of None (no
! newline read yet), "\r", "\n", "\r\n" or a tuple containing all the
! newline types seen.
***************
*** 162,165 ****
--- 162,175 ----
fgets() or fread() replacement routines, just some integer-valued
flags, so the chances of core dumps are zero (he said:-).
+
+ Universal newline support can be disabled during configure because it does
+ have a small performance penalty, and moreover the implementation has
+ not been tested on all concievable platforms yet. It might also be silly
+ on some platforms (WinCE or Palm devices, for instance). If universal
+ newline support is not enabled then file objects do not have the "newlines"
+ attribute, so testing whether the current Python has it can be done with a
+ simple
+ if hasattr(sys.stdout, 'newlines'):
+ print 'We have universal newline support'