[issue44977] Deprecate delegation of int to __trunc__?

Mark Dickinson report at bugs.python.org
Sun Aug 22 05:19:56 EDT 2021


Mark Dickinson <dickinsm at gmail.com> added the comment:

> This decouples int from __trunc__ and leaves __trunc__ as simply the support for the math.trunc function.

Argh; copy and paste fail - I left out the crucial line.

I propose deprecating the delegation of int to __trunc__: calls to int(a) where type(a) implements __trunc__ but not __int__ or __index__ would raise a DeprecationWarning, and at some point in the future int(a) would become a TypeError.

----------

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


More information about the Python-bugs-list mailing list