Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'operator': 0.03; 'method.': 0.07; '===': 0.09; 'comments?': 0.09; 'currently,': 0.09; 'logic': 0.09; 'subtle': 0.09; 'cc:addr:python-list': 0.11; '5:00': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'fuzzy': 0.16; 'notation': 0.16; 'operator;': 0.16; 'pockets': 0.16; 'python",': 0.16; 'subject:operators': 0.16; 'thoughts?': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'differ': 0.19; "python's": 0.19; 'saying': 0.22; 'cc:addr:python.org': 0.22; 'creating': 0.23; 'cc:2**0': 0.24; 'define': 0.26; 'posts': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; '"do': 0.31; "d'aprano": 0.31; 'equality': 0.31; 'operators': 0.31; 'really,': 0.31; 'steven': 0.31; 'probably': 0.32; 'another': 0.32; 'everyone': 0.33; 'cases': 0.33; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'similar': 0.36; 'should': 0.36; 'wrong': 0.37; 'two': 0.37; 'pm,': 0.38; 'how': 0.40; 'problems.': 0.60; 'new': 0.61; "you're": 0.61; 'first': 0.61; 'kind': 0.63; 'skip:n 10': 0.64; 'pick': 0.64; 'different': 0.65; 'surrounding': 0.68; 'safe': 0.72; 'jul': 0.74; 'truth': 0.81; 'confusion.': 0.84; 'fat': 0.84; 'subject:Proposal': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=7t1KJIZVrf0zR5j/Br3ZHgDSs36qVLLyGG+YjXOffSI=; b=b8b3swkurMFwMuGGxlEyX3xP963GyC+HojJYy+4jAgKF1Qa7IRTUE9jNlGX4LZkZjq A4tsx++4TtPE17Ubflo5JXCdDm0TCraW7dUKTslpSdytbPBKnEdjV9/KFINAwWHGixHD yzsah8c1Pt8R6va9rkLih85ZbCf6VOgoOoZFqVFEgR59SLcY0tKk+MTuYUFKrbarMtgL rYNlQrcsfRQEPbFpQ2Be2pmcuUc8DHwQKu77ANSUPsJSvbhw8R0RNnc2LEtT30KKdQ1U K2aqJODcv/tDBpBC96cY896ysCpsfRy80e070Ar96Q5VZnAbUM3V2iNOmn6Apw9S5Fl0 2J0Q== MIME-Version: 1.0 X-Received: by 10.52.118.99 with SMTP id kl3mr31931818vdb.18.1404890480760; Wed, 09 Jul 2014 00:21:20 -0700 (PDT) In-Reply-To: <53bce8a3$0$2746$c3e8da3$76491128@news.astraweb.com> References: <53bce8a3$0$2746$c3e8da3$76491128@news.astraweb.com> Date: Wed, 9 Jul 2014 17:21:20 +1000 Subject: Re: Proposal: === and !=== operators From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1404890483 news.xs4all.nl 2921 [2001:888:2000:d::a6]:36883 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74234 On Wed, Jul 9, 2014 at 5:00 PM, Steven D'Aprano wrote: > Thoughts? Comments? First thought: It will just add confusion. Currently, there are small pockets of confusion surrounding the few cases where something's non-reflexive, and there are occasional threads on the subject, like we have now. Adding another pair of equality operators will mean that everyone has to think "Do I want == or ===?", and we just need to look at PHP and ECMAScript to see what happens - people pick the wrong operator and have no end of subtle problems. There will be blog posts around saying "always use === in Python", or "never use === in Python", and everyone will get confused about how Python's === is similar to and/or different from ECMAScript's and/or PHP's, and ultimately, the only people who win out will be those who get paid to write blog posts. I think this is a big fat YAGNI. The two operators will differ in so few situations that you may as well just define a few cases as "x is y or x == y" instead of creating thew new operator; because really, that's all that's happening here. (And the Py3 docs now use that kind of notation to describe 'in'.) If you want fuzzy logic or three-valued truth or anything, you probably know the types of the things you're comparing, so it should be safe to use a method. ChrisA