[issue46990] Surprising list overallocation from .split()

Jelle Zijlstra report at bugs.python.org
Fri Mar 11 19:56:51 EST 2022


Jelle Zijlstra <jelle.zijlstra at gmail.com> added the comment:

The value 12 is hardcoded here: https://github.com/python/cpython/blob/a89c29fbcc7e7e85848499443d819c3fab68c78a/Objects/stringlib/split.h#L14

The comment there says that this is because most .split() calls are on lines of human-readable text, which has about 11 words per line. I don't know if I believe that.

----------
nosy: +JelleZijlstra

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46990>
_______________________________________


More information about the Python-bugs-list mailing list