A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2018-June/153960.html below:

[Python-Dev] About [].append == [].append

[Python-Dev] About [].append == [].append [Python-Dev] About [].append == [].appendAntoine Pitrou solipsis at pitrou.net
Thu Jun 21 07:30:02 EDT 2018
On Thu, 21 Jun 2018 13:25:19 +0200
Jeroen Demeyer <J.Demeyer at UGent.be> wrote:
> Currently, we have:
> 
>  >>> [].append == [].append  
> False
> 
> However, with a Python class:
> 
>  >>> class List(list):  
> ...     def append(self, x): super().append(x)
>  >>> List().append == List().append  
> True
> 
> In the former case, __self__ is compared using "is" and in the latter 
> case, it is compared using "==".
> 
> I think that comparing using "==" is the right thing to do because "is" 
> is really an implementation detail.

Probably... though comparing bound methods doesn't sound terribly
useful, so I'm not sure how much of an issue this is in practice.

Regards

Antoine.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4