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

<- View Parent
FooBarrington@lemmy.world ⁨1⁩ ⁨week⁩ ago

Yes, the first example does the same thing, but there’s still less to mentally parse. Ideally you should just use if len(my list) == 0:.

source
Sort:hotnewtop