Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'operator': 0.03; 'assignment': 0.07; 'variables': 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; 'wrote': 0.14; '[x]': 0.16; 'definition.': 0.16; 'kern': 0.16; 'mathematics.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'underlying': 0.16; 'wrote:': 0.18; 'programming': 0.22; 'header:User-Agent:1': 0.23; 'interpret': 0.24; 'mathematical': 0.24; 'initial': 0.24; 'header:X-Complaints-To:1': 0.27; 'header :In-Reply-To:1': 0.27; 'robert': 0.30; 'subject:list': 0.30; "d'aprano": 0.31; 'go.': 0.31; 'steven': 0.31; "we're": 0.32; 'subject:the': 0.34; 'but': 0.35; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'our': 0.64; 'places': 0.64; 'more': 0.64; 'different': 0.65; 'world': 0.66; 'believe': 0.68; 'subject:get': 0.81; 'distinguish': 0.84; 'eco': 0.84; 'equation,': 0.84; 'terrible': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robert Kern Subject: Re: how to get the ordinal number in list Date: Mon, 11 Aug 2014 12:56:59 +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=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 213.1.240.226 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <53e824b9$0$30000$c3e8da3$5496439d@news.astraweb.com> 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: 1407758245 news.xs4all.nl 2841 [2001:888:2000:d::a6]:42756 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76050 On 2014-08-11 03:04, Steven D'Aprano wrote: > Rustom Mody wrote: > >> Its when we have variables that are assigned in multiple places that >> we start seeing mathematical abominations like >> x = x+1 > > That's not a mathematical abomination. It's a perfectly reasonable > mathematical equation, one with no solutions since the line f(x) = x and > the line f(x) = x+1 are parallel. > > But what does this have to do with programming? Programming *is not* > mathematics, and x = x+1 has a different meaning in programming than in > mathematics. Perhaps it would help if we wrote it using mathematical > notation? Using [x] for subscripts: > > x[n+1] = x[n] + 1 > > we have a perfectly good mathematical recursive definition. All it needs is > an initial value x[0] and we're good to go. Or a different operator for assignment (to distinguish it more clearly from equality, which it isn't). x <- x + 1 x := x + 1 -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco