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/2003-December/040989.html below:

[Python-Dev] Changing semantics of issubclass when accepting atuple

[Python-Dev] Changing semantics of issubclass when accepting atuple [Python-Dev] Changing semantics of issubclass when accepting atupleGuido van Rossum guido at python.org
Mon Dec 15 00:59:57 EST 2003
> The same effect could be achieved by defining a class...
> 
>   class my_favourite_types(float, complex):
>     pass
> 
>   if isinstance(x, (int, long, my_favourite_types)):
>     ...

I hope you forgot the smiley, as this would otherwise have to be
explained as a typical "before the first coffee" lapse. :)

First of all, you can't multiply inherit from built-in classes.  But
even if you could, it would be wrong: while an instance of
my_favourite_types would indeed be an instance of float,
3.14 is not an instance of my_favourite_types!  You'd need
my_favourite_types to be a common base class of float and complex for
the test to work the way you want it.

--Guido van Rossum (home page: http://www.python.org/~guido/)

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