[issue11107] Cache constant "slice" instances

Terry J. Reedy report at bugs.python.org
Sat Nov 28 07:29:53 EST 2020


Terry J. Reedy <tjreedy at udel.edu> added the comment:

Batuhan Taskaya opened a duplicate issue #42454.  Since it includes PR-23496, with some review, and at least as much discussion, I am closing this issue, contrary to normal policy.

Worthwhile? Batuhan found about 100000 constant slices in 3200 PyPI packages, and 3-50% speedup.

Rémi asked "Couldn't [slices] hash like a tuple (start, stop, step)?"
Batuhad used the tuple analogy - hashability and hash depends on components.  See PR for details.

Josh: the PR defines TYPE_SLICE as ':'.

----------
nosy: +terry.reedy
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> Move slice creation to the compiler for constants

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


More information about the Python-bugs-list mailing list