homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients hroncok, mark.dickinson, vstinner
Date 2020年01月31日.14:44:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1580481887.09.0.813730239032.issue39350@roundup.psfhosted.org>
In-reply-to
Content
The relevant piece of Python code from fractions.py looks like this:
 if type(numerator) is int is type(denominator):
 # *very* normal case
 g = math.gcd(numerator, denominator)
 if denominator < 0:
 g = -g
 else:
 g = _gcd(numerator, denominator)
I wonder whether we should simply drop the type check: math.gcd should accept anything that supports __index__ (and that includes NumPy integer types and anything that implements numbers.Integral).
OTOH, math.gcd will return a plain int, and if we have some subclass myint of int, we might want all the arithmetic to stay in the domain of myints (though I'm not really sure _why_ we'd want that). In that case we'll need to restore the pure Python _gcd implementation.
History
Date User Action Args
2020年01月31日 14:44:47mark.dickinsonsetrecipients: + mark.dickinson, vstinner, hroncok
2020年01月31日 14:44:47mark.dickinsonsetmessageid: <1580481887.09.0.813730239032.issue39350@roundup.psfhosted.org>
2020年01月31日 14:44:47mark.dickinsonlinkissue39350 messages
2020年01月31日 14:44:46mark.dickinsoncreate

AltStyle によって変換されたページ (->オリジナル) /