Steven D'Aprano added the comment:
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.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18842>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com