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

<- View Parent
LegoBrickOnFire@lemmy.world ⁨2⁩ ⁨days⁩ ago

I agree. So if None is a valid input we should check it first, and then check if the length is zero. In this situation, we see a type error only if the programmer screwed up and everything is explicit

source
Sort:hotnewtop