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

antlion@lemmy.dbzer0.com ⁨6⁩ ⁨days⁩ ago

Could also compare against:

if not len(mylist)

That way this version isn’t evaluating two functions. The bool evaluation of an integer is false when zero, otherwise true.

source
Sort:hotnewtop