Tin mới
collections — Container datatypes
Added in version 3.3: Formerly, this module was part of the collections module.
Collections Abstract Base Classes¶
Added in version 3.3: Formerly, this module was part of the collections module.
Added in version 3.9: These abstract classes now support []. See Generic Alias Type and PEP 585.
These ABCs override __subclasshook__() to support testing an interface by verifying the required methods are present and have not been set to None. This only works for simple interfaces. More complex interfaces require r
Checking isinstance(obj, Iterable) detects classes that are registered as Iterable or that have an __iter__() method, but it does not detect classes that iterate with the __getitem__() method. The only reliable way to de
ABC for classes that provide the __call__() method.
In CPython, generator-based coroutines (generators decorated with @types.coroutine) are awaitables, even though they do not have an __await__() method. Using isinstance(gencoro, Awaitable) for them will return False. Use