[Python-Dev] Symmetry arguments for API expansion (original) (raw)
Robert Smallshire rob at sixty-north.com
Tue Mar 27 16:16:25 EDT 2018
- Previous message (by thread): [Python-Dev] Symmetry arguments for API expansion
- Next message (by thread): [Python-Dev] Symmetry arguments for API expansion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In the PR I've submitted, that's essentially what I'm doing for the default Real.is_integer() implementation. The details differ slightly, in that I rely on the int() constructor to call trunc(), rather than introduce a new dependency on the math module.
On Tue, 27 Mar 2018 at 21:29, Chris Barker <chris.barker at noaa.gov> wrote:
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 isinteger() methods to numeric objects, but might if we wanted to add a generic isinteger() 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 >>> isinteger() -- Serhiy believes it is not useful (and even an attractive >>> nuisance) and should be deprecated. OTOH the existence of >>> decmpdisinteger() seems to validate to me that it actually exposes useful >>> functionality (and every Python feature can be abused, so that alone should >>> not >>>>>> ) >> _________________________ Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/rob%40sixty-north.com
*Robert Smallshire | *Managing Director Sixty North | Applications | Consulting | Training rob at sixty-north.com | T +47 63 01 04 44 | M +47 924 30 350 http://sixty-north.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20180327/748a06bb/attachment.html>
- Previous message (by thread): [Python-Dev] Symmetry arguments for API expansion
- Next message (by thread): [Python-Dev] Symmetry arguments for API expansion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]