Comment on Python Performance: Why 'if not list' is 2x Faster Than Using len()

<- View Parent
gravitas_deficiency@sh.itjust.works ⁨5⁩ ⁨days⁩ ago

My point is that the second statement you presented can have the effect of evaluating emptiness of a Sequence (note: distinct from an Iterable), but that only holds true if the target of the conditional IS a sequence. I’m underlining the semantic difference that was elided as a result of falsey evaluation.

source
Sort:hotnewtop