[ python-Bugs-800828 ] Doc bug in PEP-0278

SourceForge.net noreply at sourceforge.net
Thu May 6 08:28:39 EDT 2004


Bugs item #800828, was opened at 2003-09-04 22:18
Message generated for change (Comment added) made by fdrake
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=800828&group_id=5470

Category: Documentation
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: logistix (logistix)
Assigned to: Jack Jansen (jackjansen)
Summary: Doc bug in PEP-0278

Initial Comment:
PEP 278 suggests that the proper way to test for 
universal newline support is 'hasattr
(sys.stdout, "newline")'  However, this doesn't work too 
well when sys.stdout is overridden.  One big example of 
this is PythonWin's sys.stdout, which doesn't have an 
newlines attribute even when it is supported by 
python23.dll.

Testing 'hasattr(file, "newlines")' seems to be a more 
reliable way to test.

----------------------------------------------------------------------

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2004-05-06 08:28

Message:
Logged In: YES 
user_id=3066

Fixed.  I changed the test to use "hasattr(open,
'newlines')" to be compatible with older versions of Python
as well as avoiding the replacement problem you noted.

nondist/peps/pep-0278.txt revision 1.9


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=800828&group_id=5470



More information about the Python-bugs-list mailing list