Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51940

Bug? ( () == [] ) != ( ().__eq__([]) )

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python@markusrother.de>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.126
X-Spam-Level *
X-Spam-Evidence '*H*': 0.77; '*S*': 0.02; 'everybody.': 0.16; 'from:addr:python': 0.16; 'to:name:python list': 0.16; 'thanks,': 0.17; 'seems': 0.21; '>>>': 0.22; 'header:User-Agent:1': 0.23; '3.2': 0.31; 'received:84': 0.35; 'false': 0.36; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:n 10': 0.64; 'received:arcor-ip.net': 0.84; 'received:pools .arcor-ip.net': 0.84
Date Mon, 05 Aug 2013 00:35:58 +0200
From Markus Rother <python@markusrother.de>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130422 Thunderbird/17.0.5
MIME-Version 1.0
To Python List <python-list@python.org>
Subject Bug? ( () == [] ) != ( ().__eq__([]) )
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-bounce-key webpack.hosteurope.de; python@markusrother.de; 1375656718; c63cfae2;
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.192.1375656719.1251.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1375656719 news.xs4all.nl 15888 [2001:888:2000:d::a6]:42016
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:51940

Show key headers only | View raw


Hello,

The following behaviour seen in 3.2 seems very strange to me:

As expected:
 >>> () == []
False

However:
 >>> ().__eq__([])
NotImplemented
 >>> [].__eq__(())
NotImplemented

And:
 >>> bool(NotImplemented)
True

Hence:
 >>> bool(().__eq__([]))
True
 >>> ( () == [] ) != ( ().__eq__([]) )
True

How/why can this be intended?

Thanks, everybody.

Markus R.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Bug? ( () == [] ) != ( ().__eq__([]) ) Markus Rother <python@markusrother.de> - 2013-08-05 00:35 +0200

csiph-web