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

borokov@lemmy.world ⁨5⁩ ⁨days⁩ ago

Isn’t it because list is linked list, so to get the Len it has to iterate over the whole list whereas to get emptyness it just have to check if there is a 1st element ?

I’ too lazy to read the article BTW.

source
Sort:hotnewtop