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

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

You’re checking if mylist is falsey. Sometimes that’s the same as checking if it’s empty, if it’s actually a list, but that’s not guaranteed.

source
Sort:hotnewtop