@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-square118fedilinkarrow-up11arrow-down10
arrow-up11arrow-down1external-linkPython Performance: Why 'if not list' is 2x Faster Than Using len()blog.codingconfessions.com@abhi9u@lemmy.world to Technology@lemmy.worldEnglish • 1 year agomessage-square118fedilink
minus-square@JasonDJ@lemmy.ziplinkfedilinkEnglish0•1 year agoOk, help a noob out. What is the difference between a sequence and an iterable? Is a sequence immutable, like a tuple?
minus-square@48954246@lemmy.worldlinkfedilinkEnglish0•1 year 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
Ok, help a noob out. What is the difference between a sequence and an iterable? Is a sequence immutable, like a tuple?
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