# Changing str.splitlines to match file readlines

**URL:** <https://discuss.python.org/t/changing-str-splitlines-to-match-file-readlines/174>\
**Category:** Ideas\
**Created:** [October 5, 2018, 3:44am UTC](https://discuss.python.org/t/changing-str-splitlines-to-match-file-readlines/174 "2018-10-05T03:44:01Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![methane](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/methane/32/43_2.png) [@methane](https://discuss.python.org/u/methane)\
**Post date:** [October 5, 2018, 8:32am UTC](https://discuss.python.org/t/changing-str-splitlines-to-match-file-readlines/174/2 "2018-10-05T08:32:26Z")

</div>

I agree that "same to `io.readlines()`" is the behavior 99% people expect.  
This backward incompatible change will _fix_ more bugs in user applications than _break_ user application.

But breaking backward compatibility is a hard decision, always.

More easy way is adding a new method: `str.iterlines{[keepends])`.  
This is ugly, but backward compatible.

---

_[View the full topic](https://discuss.python.org/t/changing-str-splitlines-to-match-file-readlines/174)._
