[Python-Dev] Re: Do not fallback to __trunc__ when convert to int

2019年11月02日 04:57:30 -0700

On Fri., 1 Nov. 2019, 8:10 am Guido van Rossum, <[email protected]> wrote:
> It seems a good idea to add __int__ to Fraction, but if you stop falling
> back to __trunc__, won't that cause backwards compatibility issues? I'd say
> looking for __trunc__ if the alternative is failing isn't so bad.
>
Aye, converting a case where code is slower than it needs to be to an
outright failure isn't a good trade-off.
"Implements __trunc__ but not __int__" could be a good thing for linters to
warn about, though.
Cheers,
Nick.
>
>
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/FOD5RWJFN7BWQJOZZGZIDCTY2QLMMMAL/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to