On 2022-06-18 21:55, Jonathan Slenders wrote:
Good catch! One correction here, I somewhat mixed up the benchmarks. I
forgot both projects of mine required support for universal line endings
exactly like splitlines() does this out of the box. That requires a more
complex regex pattern. I was actually using:
re.compile(r"\n|\r(?!\n)")
And then the regex becomes significantly slower than the splitlines()
solution, which is still much slower than it has to be.
If you're opening a file as text, it'll default to universal line
endings, so the strings you'll get will have only '\n' as the line ending.
[snip]
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/IULGKP4VHFLILUJ7GMQYJWQRX35F7C6A/
Code of Conduct: http://python.org/psf/codeofconduct/