Why inspect.isclass says iter() a class?

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

On Thu, Apr 11, 2019 at 3:31 PM Gregory Ewing
<greg.ewing at canterbury.ac.nz> wrote:
> Chris Angelico wrote:
> > At the moment, it isn't defined particularly as either a function or a
> > class,
> Well, it's listed under a section called "Functions", so the reader
> could be forgiven for assuming that it's a function.

Ah, fair point. Though the fact that the very next entry in the docs
is the "alternative constructor" chain.from_iterable, you can likely
deduce that it's actually a class.

> From a high
> level point of view, it is -- you call it and it returns something.
> Concretely, it happens to be implemented as a class, but that's not
> something you need to know in order to use it, so the docs don't
> mention it.

Exactly. Doesn't make a lot of difference whether it's a factory
function or a class.


More information about the Python-list mailing list