generic-collections

Difference between collections.abc.Sequence and typing.Sequence

Difference between collections.abc.Sequence and typing.Sequence Question: I was reading an article and about collection.abc and typing class in the python standard library and discover both classes have the same features. I tried both options using the code below and got the same results from collections.abc import Sequence def average(sequence: Sequence): return sum(sequence) / len(sequence) print(average([1, …

Total answers: 2