@abhi9u@lemmy.world to Technology@lemmy.worldEnglish • 18 days agoPython Performance: Why 'if not list' is 2x Faster Than Using len()blog.codingconfessions.comexternal-linkmessage-square150fedilinkarrow-up1219arrow-down122cross-posted to: python@programming.dev
arrow-up1197arrow-down1external-linkPython Performance: Why 'if not list' is 2x Faster Than Using len()blog.codingconfessions.com@abhi9u@lemmy.world to Technology@lemmy.worldEnglish • 18 days agomessage-square150fedilinkcross-posted to: python@programming.dev
minus-square@48954246@lemmy.worldlinkfedilinkEnglish1•18 days agoAn iterable is just something that can be iterated over, like range(10), or [1, 2, 3]. A sequence on the other hand is a Collection that is reversible. https://docs.python.org/3/library/collections.abc.html#collections-abstract-base-classes
minus-square@gravitas_deficiency@sh.itjust.workslinkfedilinkEnglish1•18 days agoI know what an iterable is. But I am talking about Type[Iterable], which iirc does not obey falsey eval when empty.
An iterable is just something that can be iterated over, like
range(10)
, or[1, 2, 3]
.A sequence on the other hand is a Collection that is reversible.
https://docs.python.org/3/library/collections.abc.html#collections-abstract-base-classes
I know what an iterable is. But I am talking about
Type[Iterable]
, which iirc does not obey falsey eval when empty.