Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'operator': 0.03; 'assignment': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:number': 0.09; 'python': 0.11; 'def': 0.12; 'discarded': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reversed': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'example': 0.22; 'header:User-Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'quickly': 0.29; "doesn't": 0.30; 'subject:list': 0.30; 'equality': 0.31; 'operators': 0.31; 'class': 0.32; 'languages': 0.32; 'programmers': 0.33; 'skip:_ 10': 0.34; 'subject:the': 0.34; 'equal': 0.35; 'but': 0.35; 'false': 0.36; 'two': 0.37; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'major': 0.40; 'even': 0.60; 'course': 0.61; 'skip:n 10': 0.64; 'more': 0.64; 'different': 0.65; 'received:109': 0.72; 'subject:get': 0.81; 'confusing': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robin Becker Subject: Re: how to get the ordinal number in list Date: Mon, 11 Aug 2014 15:32:47 +0100 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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 109.174.168.73 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: 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: 1407767580 news.xs4all.nl 2894 [2001:888:2000:d::a6]:35713 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76063 On 11/08/2014 13:30, alister wrote: > It already is a different operator from equality which is == > > perhaps it would have been better if the behaviour of these two operators > were reversed (= for equality & == for assignment) but i suspect that > Idea if even considered was quickly discarded as it would cause major > confusion to programmers who work with multiple languages 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. -- Robin Becker