Movatterモバイル変換
[0]ホーム
[Python-Dev] 51 Million calls to _PyUnicodeUCS2_IsLinebreak() (???)
"Martin v. Löwis"martin at v.loewis.de
Wed Aug 24 14:56:30 CEST 2005
Walter Dörwald wrote:> I think a maxsplit argument (just as for unicode.split()) would help too.Correct - that would allow to get rid of the quadratic part.We should also strive for avoiding the second copy of the line,if the user requested keepends.I wonder whether it would be worthwhile to cache the .splitlines result.An application that has just invoked .readline() will likely invoke.readline() again. If there is more than one line left, we could returnthe first line right away (potentially trimming the line ending ifnecessary). Only when a single line is left, we would attempt toread more data. In a plain .read(), we would first join the linesback.Regards,Martin
More information about the Python-Devmailing list
[8]ページ先頭