Message355642
The numbers.Real ABC requires the __ceil__ and __floor__ methods (https://github.com/python/cpython/blob/v3.8.0/Lib/numbers.py#L178-L186), however, the float type does not have them.
In regular Python, this is not a problem, because math.ceil() and math.floor() special-case float and work on it directly, and numbers.Real is implemented on float by explicitly registering it (so it's not checked that all required methods are implemented).
Where it becomes a (minor) problem is in typeshed, where the type checker *does* check that all abstract methods are implemented. So, because float is missing these two, typeshed cannot have float implement numbers.Real.
Refs: https://github.com/python/typeshed/issues/3195 |
|
Date |
User |
Action |
Args |
2019-10-29 10:18:18 | bluetech | set | recipients:
+ bluetech |
2019-10-29 10:18:17 | bluetech | set | messageid: <1572344297.94.0.916739375163.issue38629@roundup.psfhosted.org> |
2019-10-29 10:18:17 | bluetech | link | issue38629 messages |
2019-10-29 10:18:17 | bluetech | create | |
|