Neil Schemenauer <nas-pyt...@arctrix.com> added the comment:

> Why not simply add a new parameter, to make people who want ASCII linebreaks 
> continue to use .splitlines() ?

That could work but I think in nearly every case you don't want to use 
splitlines() without supplying the parameter.  So, it seems like a bit of trap 
for new users.  Worse, because in Python 2, str.splitlines() does what they 
want, they will do the simple thing which is likely wrong.

If we do stick with just splitlines(), perhaps it should get a 'newline' 
parameter that mostly matches io.open (i.e. it controls universal newline 
behavior).  So if you don't want to change behavior, 
str.splitlines(newline=None) would split as it currently does.  To make it 
split like io files do, you would have to do newline='\n'.

To me, it seems attractive that:
fp.readlines() == fp.read().iterlines()

You suggestion would make it something like:
fp.readlines() == fp.read().splitlines(newline='\n')

I guess I could live with that but it seems unnecessarily ugly and verbose for 
what is the most common usage.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue22232>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to