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

<- View Parent
iAvicenna@lemmy.world ⁨4⁩ ⁨days⁩ ago

I don’t know, it throws me off but perhaps because I always use len in this context. Is there any generally applicable practical reason why one would prefer “not” over len? Is it just compactness and being pythonic?

source
Sort:hotnewtop