Re: [Python-Dev] Definition of equality check behavior

2019-05-08 Thread Jordan Adler
Ahh, I didn't locate the documentation on the NotImplemented constant as I was checking 2.7's docs, so I wasn't aware of the layer of indirection and fallback behavior for the operator. Sorry about that! Based on that, the right c

Re: [Python-Dev] Definition of equality check behavior

2019-05-08 Thread Ivan Levkivskyi
On Tue, 7 May 2019 at 22:31, Jordan Adler wrote: > Hey folks! > > Through the course of work on the future polyfills > that mimic > the behavior of Py3 builtins across versions of Python, we've discovered > that the equality check behav

Re: [Python-Dev] Definition of equality check behavior

2019-05-07 Thread Tim Peters
[Jordan Adler ] > Through the course of work on the future polyfills that mimic the behavior > of Py3 builtins across versions of Python, we've discovered that the > equality check behavior of at least some builtin types do not match the > documented core data model. > > Specifically, a comparison

Re: [Python-Dev] Definition of equality check behavior

2019-05-07 Thread Ethan Furman
On 05/07/2019 02:05 PM, Jordan Adler wrote: Specifically, a comparison between a primitive (int, str, float were tested) and an object of a different type always return False, instead of raising a NotImplementedError. Consider `1 == '1'` as a test case. If the object of a different type do

Re: [Python-Dev] Definition of equality check behavior

2019-05-07 Thread Steven D'Aprano
On Wed, May 08, 2019 at 12:05:07AM +0200, Max Vogler wrote: > Thanks for starting this discussion and addressing my issue, Jordan. > > I would like to clarify the intentions behind my original issue > : It does not > concern coercion in P

Re: [Python-Dev] Definition of equality check behavior

2019-05-07 Thread Steven D'Aprano
On Tue, May 07, 2019 at 05:05:57PM -0400, Jordan Adler wrote: [...] > Specifically, a comparison between a primitive (int, str, float were > tested) and an object of a different type always return False, instead of > raising a NotImplementedError. Consider `1 == '1'` as a test case. I think you m

Re: [Python-Dev] Definition of equality check behavior

2019-05-07 Thread Max Vogler
Thanks for starting this discussion and addressing my issue, Jordan. I would like to clarify the intentions behind my original issue : It does not concern coercion in Python's __eq__. Instead, the issue concerns the return of False instea