[Python-ideas] Binary arithmetic does not always call subclasses first
Nick Coghlan
ncoghlan at gmail.com
Thu Apr 27 10:07:44 EDT 2017
On 26 April 2017 at 02:56, Guido van Rossum <gvanrossum at gmail.com> wrote:
> In the end I agree with the OP that we should fix this. I don't see a reason
> to require a PEP or require updating whatever PEP described this behavior
> originally -- PEPs generally describe what should be done to a specific
> version of Python, they don't prevent future alterations, and they
> essentially represent the historical record, not current documentation.
>
> I'm a little worried about breaking existing code, but only a little bit,
> and this is clearly a gray area, so I think it's okay to change in 3.7
> without deprecations. (But I've been overruled on such matters before, so if
> you disagree, speak up now and show us your code!)
This is really obscure behaviour to be relying on, so a porting note +
the 3.7 pre-release testing cycles seems like sufficient notice to me.
It's potentially also worth checking how PyPy handles these cases -
for the only other similar case I'm aware of (the quirks with the
relative priority of the nb_* and sq_* slots at the C layer), enough
projects relied on the CPython behaviour for them to decide to
replicate it, so if they *haven't* replicated the quirk described in
the OP, it's a solid data point suggesting there aren't a lot of major
projects relying on it.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list