Re: Add a line_offsets() method to str
On Tue, Jun 21, 2022 at 3:49 AM Marco Sulla <Marco.Sulla.Python@gmail.com> wrote:
On Sun, 19 Jun 2022 at 03:06, Inada Naoki <songofacandy@gmail.com> wrote:
FWIW, I had proposed str.iterlines() to fix incompatibility between IO.readlines() and str.splitlines().
It's a good idea IMHO. In your mind, str.iterlines() will find only \n, \r and \r\n, as IO.readlines() do? I ask this because str.splitlines() finds all line boundary chars.
I don't remember the old discussion, but I think so. Another idea is adding some option to `splitlines()` that uses only universal newlines. (e.g. str.splitlines(keepends=False, *, ascii=False)) Then we can add `str.iterlines` that have the same arguments to `str.splitlines`. -- Inada Naoki <songofacandy@gmail.com>
participants (1)
-
Inada Naoki