This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author corona10
Recipients ammar2, corona10, mark.dickinson, pablogsal, serhiy.storchaka, vstinner
Date 2020-10-02.03:50:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1601610652.05.0.593917881258.issue41902@roundup.psfhosted.org>
In-reply-to
Content
> 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.
History
Date User Action Args
2020-10-02 03:50:52corona10setrecipients: + corona10, mark.dickinson, vstinner, serhiy.storchaka, ammar2, pablogsal
2020-10-02 03:50:52corona10setmessageid: <1601610652.05.0.593917881258.issue41902@roundup.psfhosted.org>
2020-10-02 03:50:52corona10linkissue41902 messages
2020-10-02 03:50:51corona10create