I am unclear on whether to use typing
or ABC
classes for collection type hints in Python. It seems one can use either one, but the name typing
suggests that's the preferred one. However, I see several places saying collections.abc
should be used instead, not least PEP 585.
I am getting the sense that typing
was created to support generics but that generics is being extended to the "regular" classes so typing
is becoming obsolete. Is that the correct understanding?
Yes. collections.abc
is the correct module going forward. Collections in typing
have been deprecated since 3.9