3 ms·
It's not an optimization if it pessimizes almost all usage by adding a check for the dunder
by jonathrg 1mo ago
It's not an optimization if it pessimizes almost all usage by adding a check for the dunder
- zahlman 1mo agoPlenty of people would naturally expect `if x in range(big_number, other_big_number)` to work efficiently rather than having to write the comparison logic (and modulo check, if a step is involved) explicitly. If the code has `if x in y:` where y is a duck-typed input, it's awkward to special-case that. Who is making membership checks against trivially-sized collections in a hot loop?