Dong-hee Na <donghee.n...@gmail.com> added the comment:

> s there reason to believe that range.index is performed often enough that 
> it's worth the extra code and maintenance cost here?

There are at least 3 reasons
1. pointer comparaition optimization quite common usecase in CPython codebase. 
e.x) list.count
2. if you create the range object, step = 1 which is singleton object is quite 
high percentage use case.
   - range(100) -> step = 1
   - range(-100, 100) -> step =1
   - range(-100, 100, 2) -> step != 1
3. fast path code does not cost high difficulty maintainence for this case but 
can bring 12% performance enhancement.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41902>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to