Why inspect.isclass says iter() a class?

dieter dieter at handshake.de
Thu Apr 11 01:00:54 EDT 2019


Arup Rakshit <ar at zeit.io> writes:
> From docs https://docs.python.org/3/library/itertools.html#itertools.chain I see that itertools.chain is defined as a function.

Maybe, it would have been better to state that "chain"
is a "callable": something which can be called on arguments.

For many people, "callable" is a synomym for "function",
even though Python knows other "callable"s (e.g. "class"es).

Beginners likely already know about "function" but its
generalization "callable" might be new and confuse more
than it helps. When writing documentation, you always must
balance simplicity and precision - and not everyone will
be satisfied with the resulting compromises.



More information about the Python-list mailing list