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 steven.daprano
Recipients christian.heimes, facundobatista, mark.dickinson, martin.panter, rhettinger, serhiy.storchaka, steven.daprano
Date 2017-01-29.11:01:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20170129110054.GM7345@ando.pearwood.info>
In-reply-to <1485678185.45.0.74340746494.issue18842@psf.upfronthosting.co.za>
Content
On Sun, Jan 29, 2017 at 08:23:05AM +0000, Martin Panter wrote:
> Why do you name the methods is_finite() etc with underscores, when the 
> existing methods math.isfinite() etc do not have underscores? Seems it 
> would add unnecessary confusion.

The idea is to enable duck-typing between float and Decimal. Instead of:

if isinstance(x, float):
    math.isfinite(x)
else:
    x.is_finite()

we can just say

x.is_finite() 

on both floats and decimals.
History
Date User Action Args
2017-01-29 11:01:18steven.dapranosetrecipients: + steven.daprano, rhettinger, facundobatista, mark.dickinson, christian.heimes, martin.panter, serhiy.storchaka
2017-01-29 11:01:18steven.dapranolinkissue18842 messages
2017-01-29 11:01:18steven.dapranocreate