[issue42454] Move slice creation to the compiler for constants
Batuhan Taskaya
report at bugs.python.org
Wed Nov 25 07:39:39 EST 2020
Batuhan Taskaya <isidentical at gmail.com> added the comment:
> What are the potential benefits or drawbacks for the user?
The only potential drawback that I can see is that it prevents you from distinguishing a sequence from mapping by 'accidentally' passing a slice.
The major benefit for users is that they will have a decent speed up on their slice access. Other than that, I can think of some scenarios where the slice objects can be usable. One thing that I just came up with is this example (https://gist.github.com/isidentical/a799c4ae5c318bb7ac1a9f101cb709c7). I don't claim that we are implementing this to support these kinds of obscure cases, but it doesn't hurt anyone (beside maybe become a little bit confusing for a second) and doesn't look odd when used with a decent purpose.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42454>
_______________________________________
More information about the Python-bugs-list
mailing list