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 tim.peters
Recipients mark.dickinson, steven.daprano, tim.peters
Date 2016-09-06.18:18:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473185904.87.0.621512440585.issue27975@psf.upfronthosting.co.za>
In-reply-to
Content
The only sane way to do things "like this" is to allow types to define their own special methods (like `__isnan__()`), in which case the math module defers to such methods when they exist.  For example, this is how `math.ceil(Fraction)` works, by deferring to `Fraction.__ceil__()`.  The math module itself knows nothing else about what `ceil(Fraction)` could possibly mean.  All it knows is "if the type has __ceil__ use that, else convert to float first".

I'm also -1 on adding masses of if/else if/else if/.../else constructs to the math module to build in knowledge of the builtin numeric types.  Do it "right" or not at all.

I'd just be -0 on adding masses of new __isnan__, __isinf__, ..., special methods.  They're just not useful enough often enough.
History
Date User Action Args
2016-09-06 18:18:24tim.peterssetrecipients: + tim.peters, mark.dickinson, steven.daprano
2016-09-06 18:18:24tim.peterssetmessageid: <1473185904.87.0.621512440585.issue27975@psf.upfronthosting.co.za>
2016-09-06 18:18:24tim.peterslinkissue27975 messages
2016-09-06 18:18:24tim.peterscreate