array is not subclass of Collection
Contrary to list
and contrary to CPython, array.array
is not a subclass of collections.abc.Collection
in PyPy.
Tested with PyPy 7.3.9. See the lines commented with (?)
below:
from array import array
from collections.abc import Iterable, Collection
issubclass(array, Iterable) # True
issubclass(array, Collection) # False (?)
a = array('l', [1, 2, 3])
list(iter(a)) # [1, 2, 3]
len(a) # 3
2 in a, 4 in a # (True, False)
hasattr(a, '__iter__') # True
hasattr(a, '__len__') # True
hasattr(a, '__contains__') # False (?)
isinstance(a, Iterable) # True
isinstance(a, Collection) # False (?)