Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

difference in is_subtype vs subclass for int and float #26

Open
mariusvniekerk opened this issue Dec 27, 2017 · 2 comments
Open

difference in is_subtype vs subclass for int and float #26

mariusvniekerk opened this issue Dec 27, 2017 · 2 comments
Labels

Comments

@mariusvniekerk
Copy link

Is this intended behavior?

#Python 3.6.2 | packaged by conda-forge | (default, Jul 23 2017, 23:01:38)
#Type 'copyright', 'credits' or 'license' for more information
#IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import pytypes

In [2]: issubclass(int, float)
Out[2]: False

In [3]: pytypes.is_subtype(int, float)
Out[3]: True
@mariusvniekerk
Copy link
Author

nm saw this is part of the numeric tower stuff. It might be worth explicity calling it out somewhere in the readme.

@mariusvniekerk mariusvniekerk changed the title difference in subtype fvs subclass for int and float difference in is_subtype vs subclass for int and float Dec 27, 2017
@Stewori
Copy link
Owner

Stewori commented Dec 28, 2017

Yes that is numeric tower according to PEP484. Same with float and complex. You can turn it off via pytypes.apply_numeric_tower = False.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants