Source
- Python stdlib code (
_collections_abc.py)
Iterableis more general- supports only
__iter__()
- supports only
SequenceinheritsIterable(indirectly viaCollection)- is in addition
Reversible(supports__reversed__) CollectioninheritsSized,IterableandContainer- supports
__len__()(fromSized) - supports
__iter__()(fromIterable) - supports
__contains__()(fromContainer)
- supports
tupleandstrare two examples of concrete subclasses ofSequence
- is in addition