abhi9u@lemmy.world to Technology@lemmy.worldEnglish · 1 year agoPython Performance: Why 'if not list' is 2x Faster Than Using len()blog.codingconfessions.comexternal-linkmessage-square21fedilinkarrow-up150arrow-down18
arrow-up142arrow-down1external-linkPython Performance: Why 'if not list' is 2x Faster Than Using len()blog.codingconfessions.comabhi9u@lemmy.world to Technology@lemmy.worldEnglish · 1 year agomessage-square21fedilink
minus-squareantlion@lemmy.dbzer0.comlinkfedilinkEnglisharrow-up4·1 year agoCould 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.
Could also compare against:
That way this version isn’t evaluating two functions. The bool evaluation of an integer is false when zero, otherwise true.