The Python collections.abc
module contains many handy ABCs for checking various features of objects, but one that doesn't appear to belong is Callable
. No standard collection is callable, and PEP 3119
doesn't provide any reasoning or even mention the Callable ABC, so why is it in this package instead of somewhere else?
Context: I'm writing a Python->Java compiler for fun, and I just wanted to see if there was any reasoning behind the decision so I could list that reasoning in my code.
The module originates from PEP-3119 which proposes:
Specific ABCs for containers and iterators, to be added to the collections module.
But since then, it evolved to be something more. And now a module description does not mention containters and iterators explictly. It says:
This module provides abstract base classes that can be used to test whether a class provides a particular interface; for example, whether it is hashable or whether it is a mapping.
I believe it is a collections
submodule just because it was a part of it in the past:
New in version 3.3: Formerly, this module was part of the collections module.