Michael Amrhein <mich...@adrhinum.de> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44547>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to