[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

Raymond Hettinger report at bugs.python.org
Mon Oct 5 12:32:46 EDT 2020


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

> I would have assumed that it's only making a promise that it 
> registers all the methods and properties marked *abstract* in
> the ABC. Do you have references to back up the stronger statement?

The isn't some weird or incidental promise.  It is the fundamental reason that abstract base classes exist at all (and not just in Python).

>From PEP 3119: "Each test carries with it a set of promises: it contains a promise about the general behavior of the class, and a promise as to what other class methods will be available."

>From PEP 3119: "In addition, the ABCs define a minimal set of methods that establish the characteristic behavior of the type. Code that discriminates objects based on their ABC type can trust that those methods will always be present."

> we need to either (a) revert PR 6121 and then re-do the changes,
> without the changes to numbers.py, or (b) make a second PR to undo
> the numbers.py changes.

Given that (b) can't be done in the short-run, I recommend option (a) so that there is a single clean patch and to make sure this doesn't leak into a release.  The PR changed 19 files, so the longer we wait the harder it will be to revert cleanly.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue26680>
_______________________________________


More information about the Python-bugs-list mailing list