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 mark.dickinson
Recipients josh.r, mamrhein, mark.dickinson
Date 2021-07-02.16:47:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1625244442.51.0.622248096908.issue44547@roundup.psfhosted.org>
In-reply-to
Content
Thanks, that's helpful. I guess what you _really_ want there is a duck-typed "tell me whether this value is integral and if so give me the corresponding Python int", but that's not currently easily available, so I suppose x == int(x) is the next-best thing. Possibly the "right" way from the point of view of PEP 3141 is to be testing x == math.trunc(x) instead and asking for typing.SupportsTrunc, but it seems to me that __trunc__ never did really take off the way it was intended to.

tl;dr: I agree it would make sense to add __int__ to fractions.Fraction for 3.11.
History
Date User Action Args
2021-07-02 16:47:22mark.dickinsonsetrecipients: + mark.dickinson, mamrhein, josh.r
2021-07-02 16:47:22mark.dickinsonsetmessageid: <1625244442.51.0.622248096908.issue44547@roundup.psfhosted.org>
2021-07-02 16:47:22mark.dickinsonlinkissue44547 messages
2021-07-02 16:47:22mark.dickinsoncreate