[issue20423] io.StringIO newline param has wrong default

2014-02-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The docs are now fixed, thank you!

--
resolution:  -> fixed
stage: needs patch -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20423] io.StringIO newline param has wrong default

2014-02-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 82cfab2ad98d by Antoine Pitrou in branch '3.3':
Issue #20423: fix documentation of io.StringIO's newline parameter
http://hg.python.org/cpython/rev/82cfab2ad98d

New changeset 69a2cc048c80 by Antoine Pitrou in branch '2.7':
Issue #20423: fix documentation of io.StringIO's newline parameter
http://hg.python.org/cpython/rev/69a2cc048c80

New changeset df2efd48227e by Antoine Pitrou in branch 'default':
Issue #20423: fix documentation of io.StringIO's newline parameter
http://hg.python.org/cpython/rev/df2efd48227e

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20423] io.StringIO newline param has wrong default

2014-01-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Using '\n' as default is normal: StringIOs are not stored on disk so there's no 
point in converting newlines by default (it's only slower while not improving 
interoperability). '\n' is the default line separator in Python.

So we should just fix the docs here.

The bug when using '\r' or '\r\n' should probably be fixed though (that would 
be a separate issue).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20423] io.StringIO newline param has wrong default

2014-01-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

On other hand, may be the behavior of io.StringIO is wrong. Because it is 
different from io.TextIOWrapper.

>>> io.TextIOWrapper(io.BytesIO(b'abc\r\ndef\nghi\rklm')).readlines()
['abc\n', 'def\n', 'ghi\n', 'klm']
>>> io.TextIOWrapper(io.BytesIO(b'abc\r\ndef\nghi\rklm'), 
>>> newline=None).readlines()
['abc\n', 'def\n', 'ghi\n', 'klm']
>>> io.TextIOWrapper(io.BytesIO(b'abc\r\ndef\nghi\rklm'), 
>>> newline='').readlines()
['abc\r\n', 'def\n', 'ghi\r', 'klm']
>>> io.TextIOWrapper(io.BytesIO(b'abc\r\ndef\nghi\rklm'), 
>>> newline='\n').readlines()
['abc\r\n', 'def\n', 'ghi\rklm']
>>> io.TextIOWrapper(io.BytesIO(b'abc\r\ndef\nghi\rklm'), 
>>> newline='\r').readlines()
['abc\r', '\ndef\nghi\r', 'klm']
>>> io.TextIOWrapper(io.BytesIO(b'abc\r\ndef\nghi\rklm'), 
>>> newline='\r\n').readlines()
['abc\r\n', 'def\nghi\rklm']

--
nosy: +benjamin.peterson, hynek, pitrou, stutzbach

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20423] io.StringIO newline param has wrong default

2014-01-28 Thread couplewavylines

couplewavylines added the comment:

Serhiy, you're right, I now see the default behavior is "newline='\n'".

So, the header is still wrong, and the text is "The default is to do no newline 
translation" may be incorrect too?  Or just unclear (to me anyway)?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20423] io.StringIO newline param has wrong default

2014-01-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

No, actual default is '\n'.

>>> io.StringIO('abc\r\ndef\nghi\rklm').readlines()
['abc\r\n', 'def\n', 'ghi\rklm']
>>> io.StringIO('abc\r\ndef\nghi\rklm', newline=None).readlines()
['abc\n', 'def\n', 'ghi\n', 'klm']
>>> io.StringIO('abc\r\ndef\nghi\rklm', newline='').readlines()
['abc\r\n', 'def\n', 'ghi\r', 'klm']
>>> io.StringIO('abc\r\ndef\nghi\rklm', newline='\n').readlines()
['abc\r\n', 'def\n', 'ghi\rklm']
>>> io.StringIO('abc\r\ndef\nghi\rklm', newline='\r').readlines()
['abc\r', '\r', 'def\r', 'ghi\r', 'klm']
>>> io.StringIO('abc\r\ndef\nghi\rklm', newline='\r\n').readlines()
['abc\r\r\n', 'def\r\n', 'ghi\rklm']

--
keywords: +easy
nosy: +serhiy.storchaka
stage:  -> needs patch
versions: +Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20423] io.StringIO newline param has wrong default

2014-01-28 Thread couplewavylines

Changes by couplewavylines :


Added file: http://bugs.python.org/file33780/no_translation_output.txt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20423] io.StringIO newline param has wrong default

2014-01-28 Thread couplewavylines

New submission from couplewavylines:

In io.StringIO, the newline argument's default is currently documented as 
"newline=None" in the section header. However, it's described this way:  "The 
default is to do no newline translation."  The behavior of io.StringIO is 
consistent with this description (NO newline translation). 
The header should actually read "newline=''".
"newline=None" would mean there IS newline translation by default, which is not 
the case. Code sample attached as no_translation.py.

--
assignee: docs@python
components: Documentation
files: no_translation.py
messages: 209577
nosy: couplewavylines, docs@python
priority: normal
severity: normal
status: open
title: io.StringIO newline param has wrong default
type: behavior
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file33779/no_translation.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com