[Python-Dev] Symmetry arguments for API expansion

Chris Barker chris.barker at noaa.gov
Tue Mar 27 15:26:59 EDT 2018


I know this is all done, but for completeness’ sake:

I just noticed math.trunc() and __trunc__().

So wouldn’t the “correct” way to check for an integral value be something
like:

obj.__trunc__() == obj

I don’t think this has any bearing on adding is_integer() methods to
numeric objects, but might if we wanted to add a generic is_integer()
function somewhere.

In any case, I don’t recall it being mentioned in the conversation, so
thought I’d complete the record.

-CHB





On Wed, Mar 21, 2018 at 8:31 PM Guido van Rossum <guido at python.org> wrote:

> On Wed, Mar 21, 2018 at 6:48 PM, Chris Barker <chris.barker at noaa.gov>
> wrote:
>
>> On Wed, Mar 21, 2018 at 4:12 PM, Guido van Rossum <guido at python.org>
>> wrote:
>>
>>> Thank you! As you may or may not have noticed in a different thread,
>>> we're going through a small existential crisis regarding the usefulness of
>>> is_integer() -- Serhiy believes it is not useful (and even an attractive
>>> nuisance) and should be deprecated. OTOH the existence of
>>> dec_mpd_isinteger() seems to validate to me that it actually exposes useful
>>> functionality (and every Python feature can be abused, so that alone should
>>> not
>>>
>> )
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180327/745057ce/attachment.html>


More information about the Python-Dev mailing list