A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-April/063424.html below:

[Python-Dev] Should issubclass() be more like isinstance()?

[Python-Dev] Should issubclass() be more like isinstance()?Crutcher Dunnavant crutcher at gmail.com
Wed Apr 5 02:55:32 CEST 2006
On 4/4/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Crutcher Dunnavant wrote:
>
> > A) issubclass() throws a TypeError if the object being checked is not
> > a class, which seems very strange.
>
> If I ever pass a non-class to issubclass() it's almost
> certainly a bug in my code, and I'd want to know about
> it.

Perhaps, but is it worth distorting a predicate?

> On the rare occasions when I don't want this, I'm
> happy to write
>
>    isinstance(c, type) and issubclass(c, d)

This doesn't work, did you mean?
  isinstance(c, types.ClassType) and issubclass(c, d)


> > B) issubclass() won't work on a list of classs,
>  > the way isinstance() does.
>
> That sounds more reasonable. I can't think of any
> reason why it shouldn't work.
>
> --
> Greg
>


--
Crutcher Dunnavant <crutcher at gmail.com>
littlelanguages.com
monket.samedi-studios.com
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4