Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'assignment': 0.07; 'subject:number': 0.09; 'sure,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; 'foot': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'mathematics.': 0.16; 'shooting': 0.16; 'wrote:': 0.18; 'basically': 0.19; "python's": 0.19; 'example': 0.22; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'mathematical': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; "doesn't": 0.30; 'involving': 0.30; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'comparison': 0.31; 'equality': 0.31; 'class': 0.32; 'skip:_ 10': 0.34; 'subject:the': 0.34; 'knowledge': 0.35; 'definition': 0.35; 'equal': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'false': 0.36; 'stopped': 0.38; '12,': 0.39; 'even': 0.60; 'course': 0.61; "you're": 0.61; 'skip:n 10': 0.64; 'more': 0.64; 'yourself': 0.78; 'subject:get': 0.81; 'confusing': 0.84; '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=XAzsTOfdAq5l7/5Oab1DlJBocLKclb4MjkhrKMFN9R4=; b=jUSOwh0lWN6KJcqy/0gXf4oVvy4DsASbLkhvRI4H8k6osOHNuRKycQg9t/sOsIQZzB 2ycoM5EC9Ow3eb0JfjUJ6FUBmg86+/4wt+BIJceZ9oDZK85s+5kCOASGsljo69bndMC1 uL7XK5uzAxkdQSJTOKFRxkacmOx2oZ1qpI/4eC0Leir8cS6mg/ErdhUcGIeoit12D112 FdMdArOaZonB+ri3gi7w0viLscfcn+41TXhNFXK6swNgzzC9K2/aXscECck6mn2/XsRx Mj7U6RMrjkkGPoZtS4A/+z+QEdN2aT+k5/M6vSdndZROcSUStuZbE83Llmw2AAC+dHlm QN7Q== MIME-Version: 1.0 X-Received: by 10.50.97.101 with SMTP id dz5mr19500036igb.14.1407799635978; Mon, 11 Aug 2014 16:27:15 -0700 (PDT) In-Reply-To: <53E8D40F.8000007@chamonix.reportlab.co.uk> References: <53E658CD.5020904@gmail.com> <53e59035$0$29998$c3e8da3$5496439d@news.astraweb.com> <338e8fb0-c9ec-462a-b560-1c1ff77de17e@googlegroups.com> <154cc342-7f85-4d16-b636-a1a953913c98@googlegroups.com> <8c41d779-0c26-430a-a915-08c2b962e0e7@googlegroups.com> <53e824b9$0$30000$c3e8da3$5496439d@news.astraweb.com> <53E8D40F.8000007@chamonix.reportlab.co.uk> Date: Tue, 12 Aug 2014 09:27:15 +1000 Subject: Re: how to get the ordinal number in list 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: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407799638 news.xs4all.nl 2859 [2001:888:2000:d::a6]:50954 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76087 On Tue, Aug 12, 2014 at 12:32 AM, Robin Becker wrote: > Of course Python can be even more confusing so that for example > >>>> class NeverEqual(int): > ... def __new__(cls,v): > ... self = int.__new__(cls,v) > ... return self > ... def __eq__(self,other): > ... return False > ... >>>> a=NeverEqual(1) >>>> a > 1 >>>> a==1 > False >>>> a==a > False >>>> not (a != a) > True >>>> a!=a > False >>>> > > so I think that assignment doesn't always make things equal even > chronologically. Sure, but at this point you're fiddling with the definition of equality, and Python has never stopped you from shooting yourself in the foot :) There are less contrived examples, too, like those involving floating-point round-off, which basically prove that Python's equality comparison is not the same as mathematical equality; but that doesn't stop people from comprehending that "1 + 3 == 2 + 2" in Python based on their knowledge of mathematics. ChrisA