New submission from Ran Benita <r...@unusedvar.com>:

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

----------
components: Interpreter Core, Library (Lib)
messages: 355642
nosy: bluetech
priority: normal
severity: normal
status: open
title: float is missing __ceil__() and __floor__(), required by numbers.Real
type: behavior

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

Reply via email to