This is a most excellent place for technology news and articles.
Ok, help a noob out. What is the difference between a sequence and an iterable? Is a sequence immutable, like a tuple?
thing: Sequence[Any] iirc is iterable, indexable, and reversible.
thing: Sequence[Any]
thing: Iterable[Any] only guarantees that its iterable - and note that iterating can sometimes have the effect of consuming the iterable (e.g. when working with streaming interfaces)
thing: Iterable[Any]
An iterable is just something that can be iterated over, like range(10), or [1, 2, 3].
range(10)
[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.
Type[Iterable]
Ok, help a noob out. What is the difference between a sequence and an iterable? Is a sequence immutable, like a tuple?
thing: Sequence[Any]iirc is iterable, indexable, and reversible.thing: Iterable[Any]only guarantees that its iterable - and note that iterating can sometimes have the effect of consuming the iterable (e.g. when working with streaming interfaces)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.