[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why inspect.isclass says iter() a class?

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.