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

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

isn’t the expected behaviour exactly identical on any object that has len defined:

“By default, an object is considered true unless its class defines either a bool() method that returns False or a len() method that returns zero, when called with the object.”

source
Sort:hotnewtop