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 mamrhein
Recipients josh.r, mamrhein, mark.dickinson
Date 2021-07-02.13:36:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1625232969.57.0.273722007446.issue44547@roundup.psfhosted.org>
In-reply-to
Content
The background is an implementation of __pow__ for a fixed-point decimal number:

SupportsIntOrFloat = Union[SupportsInt, SupportsFloat]

def __pow__(self, other: SupportsIntOrFloat, mod: Any = None) -> Complex:
    if isinstance(other, SupportsInt):
        exp = int(other)
        if exp == other:
            ... handle integer exponent
    if isinstance(other, SupportsFloat):
        # fractional exponent => fallback to float
        return float(self) ** float(other)
    return NotImplemented

I came across SupportsInt and SupportsFloat, because they are used in typeshed as param types for int and float.
History
Date User Action Args
2021-07-02 13:36:09mamrheinsetrecipients: + mamrhein, mark.dickinson, josh.r
2021-07-02 13:36:09mamrheinsetmessageid: <1625232969.57.0.273722007446.issue44547@roundup.psfhosted.org>
2021-07-02 13:36:09mamrheinlinkissue44547 messages
2021-07-02 13:36:09mamrheincreate