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; 'programmer': 0.03; 'variables': 0.07; 'correspond': 0.09; 'latter': 0.09; 'python:': 0.09; 'style.': 0.09; 'subject:number': 0.09; 'cc:addr:python- list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'materially': 0.16; 'sees': 0.16; 'statements,': 0.16; 'applies': 0.16; 'wrote:': 0.18; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'solutions.': 0.26; 'certain': 0.27; 'values': 0.27; 'header :In-Reply-To:1': 0.27; 'generally': 0.29; "doesn't": 0.30; 'change,': 0.30; 'subject:list': 0.30; 'message- id:@mail.gmail.com': 0.30; 'asked': 0.31; 'assumes': 0.31; 'boundary': 0.31; 'fine,': 0.31; 'programmers': 0.33; 'subject:the': 0.34; 'problem.': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'words,': 0.36; 'writes': 0.38; 'pm,': 0.38; 'explain': 0.39; 'moving': 0.39; 'how': 0.40; 'around.': 0.60; "you're": 0.61; 'here:': 0.62; 'different': 0.65; 'subject:get': 0.81; 'imperative.': 0.84; 'inherent': 0.84; 'execution,': 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=6gZiBalBy2R4WCIn8UpoE99ybuU/Ucmh6IjKnvKtUNY=; b=VgEvjN6+AVmaBGX9zPJRV+BBO3eg+oG/TqGuuLs4Snf9fnuT53wmjFRgiu+K9M7m6o EPIWGmY1VFUkBOn2qx9aMIps87P08X7vxplxK9IPsgE6KbET3WCa/bIQY/RPjHh+TWYN tNH2O4EEsluCJQPMGyVH7W+ToTF+y2IJBiiC52ZkOUo+0D9NzDpKEVVIOAB+S2mhcQGI v1QlbQsBxHXFclFynPbbh2CwfPAbflR2RAIAd4iK7ijehOgic5QRp+NFsehrJZc3gAp4 b6CzHBpWCbrTKFSP6frtGI8lq1XTVlzxZLJCA2WVIcGgh6j+Cs6iG4AFk4Itjaf7JRek vA1w== MIME-Version: 1.0 X-Received: by 10.50.176.202 with SMTP id ck10mr27156505igc.2.1407735985816; Sun, 10 Aug 2014 22:46:25 -0700 (PDT) In-Reply-To: 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> Date: Mon, 11 Aug 2014 15:46:25 +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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407735995 news.xs4all.nl 2853 [2001:888:2000:d::a6]:57002 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76025 On Mon, Aug 11, 2014 at 3:23 PM, Rustom Mody wrote: > A C programmer asked to swap variables x and y, typically writes something like > > t = x; x = y; y = t; > > Fine, since C cant do better. > But then he assumes that that much sequentialization is inherent to the problem... > Until he sees the python: > > x,y = y,x > > The same applies generally to all programmers brought up on imperative style. Uhh, that's still imperative. There is a chronological boundary here: prior to that statement's execution, x and y have certain values, and after it, they have the same values but the other way around. When you're manipulating algebraic statements, moving down the page doesn't correspond to any sort of time change, which is why "x = x + 1" has no solutions. Please explain to me how "x,y = y,x" is materially different from "x = x + 1" in that the latter is, in your words, an abomination, but you say the former doesn't have the same problem. ChrisA