Skip to content

Tag: isinstance

Should `isinstance()` check against typing or collections.abc?

Both typing and collections.abc includes similar type such as Mapping, Sequence, etc. Based on the python documentation, it seems that collections.abc is preferred for type checking: This module provides abstract base classes that can be used to test whether a class provides a particular interface; for exampl…