Re: [Python-Dev] Overloading comparison operator for lists

2019-05-29 Thread Steven D'Aprano
Hi Montana, As Cameron Simpson already pointed out, your query is off-topic for the Python-Dev mailing list and should be taken to the Python-Ideas mailing list, which is for speculative discussion of new designs. Like Cameron, I've CCed Python-Ideas. Please send any follow-ups to that list an

Re: [Python-Dev] Overloading comparison operator for lists

2019-05-28 Thread Terry Reedy
On 5/28/2019 11:35 PM, Montana Burr wrote: What is the justification for causing list == 3 to evaluate to False, besides the obvious "a list cannot equal a number"? That is completely sufficient. The default comparison is by id, and a class must override to get something different. The 'def

Re: [Python-Dev] Overloading comparison operator for lists

2019-05-28 Thread Montana Burr
Ok, now I'm mildly curious to knpw: What is the justification for causing list == 3 to evaluate to False, besides the obvious "a list cannot equal a number"? On Tue, May 28, 2019 at 9:34 PM Montana Burr wrote: > Ok, now I'm mildly curious to knpw: > > What is the justification for causing list

Re: [Python-Dev] Overloading comparison operator for lists

2019-05-28 Thread Rob Cliffe via Python-Dev
On 27/05/2019 04:52:17, Montana Burr wrote: NumPy arrays have this awesome feature, where array == 3 does an element-wise comparison and returns a list. For example: np.array([1,2,3,4,5])==3 returns [False,False,True,False,False] It would be cool if Python had similar functionality for lis

Re: [Python-Dev] Overloading comparison operator for lists

2019-05-26 Thread Cameron Simpson
This belongs on python-ideas, not python-dev. I've directed replies to this message there. Comments below. On 26May2019 21:52, Montana Burr wrote: NumPy arrays have this awesome feature, where array == 3 does an element-wise comparison and returns a list. For example: np.array([1,2,3,4,5])==3

[Python-Dev] Overloading comparison operator for lists

2019-05-26 Thread Montana Burr
NumPy arrays have this awesome feature, where array == 3 does an element-wise comparison and returns a list. For example: np.array([1,2,3,4,5])==3 returns [False,False,True,False,False] It would be cool if Python had similar functionality for lists. If that is not possible, perhaps we could co