abhi9u@lemmy.world to Technology@lemmy.worldEnglish · 8 days agoPython Performance: Why 'if not list' is 2x Faster Than Using len()blog.codingconfessions.comexternal-linkmessage-square147fedilinkarrow-up1214arrow-down123
arrow-up1191arrow-down1external-linkPython Performance: Why 'if not list' is 2x Faster Than Using len()blog.codingconfessions.comabhi9u@lemmy.world to Technology@lemmy.worldEnglish · 8 days agomessage-square147fedilink
minus-squareFooBarrington@lemmy.worldlinkfedilinkEnglisharrow-up1arrow-down1·edit-27 days agoYes, 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:.
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:
.