Why inspect.isclass says iter() a class?

Chris Angelico rosuav at gmail.com
Thu Apr 11 01:11:57 EDT 2019


On Thu, Apr 11, 2019 at 3:02 PM dieter <dieter at handshake.de> wrote:
>
> 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.

At the moment, it isn't defined particularly as either a function or a
class, so all you can assume is that it is indeed a callable.

The docs say that it is *roughly* equivalent to the code below it. As
with most of itertools, there are a variety of edge cases that will
behave oddly in the simple sample code given, but are correctly
handled by the actual implementation.

ChrisA



More information about the Python-list mailing list