Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed2.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'programmer': 0.03; 'from:addr:yahoo.co.uk': 0.04; 'suppose': 0.07; 'variables': 0.07; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:number': 0.09; 'assume': 0.14; 'language.': 0.14; '-tkc': 0.16; 'lhs': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'rhs': 0.16; 'roy': 0.16; ':-)': 0.16; 'language': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header:User- Agent:1': 0.23; 'gets': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'tim': 0.29; 'subject:list': 0.30; 'asked': 0.31; 'chase': 0.31; 'fine,': 0.31; 'hacker': 0.31; 'says': 0.33; 'subject:the': 0.34; 'knows': 0.35; 'something': 0.35; 'but': 0.35; 'really': 0.36; "i'll": 0.36; 'writes': 0.38; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'such': 0.63; 'our': 0.64; 'charset:windows-1252': 0.65; 'smith': 0.68; 'subject:get': 0.81 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: how to get the ordinal number in list Date: Mon, 11 Aug 2014 14:57:38 +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> <20140811073004.6138f75d@bigbox.christie.dr> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-92-24-211-113.ppp.as43234.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 In-Reply-To: <20140811073004.6138f75d@bigbox.christie.dr> 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: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407765476 news.xs4all.nl 2976 [2001:888:2000:d::a6]:55578 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76060 On 11/08/2014 13:30, Tim Chase wrote: > On 2014-08-11 07:55, Roy Smith 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. >> >> Sure C can do better. >> >> x = x ^ y >> y = y ^ x >> x = x ^ y >> >> Any self-respecting C hacker would write it this way :-) > > Pish, such redundancy...everyone knows a C programmer would write > that as > > x ^= y > y ^= x > x ^= y > > :-) > > -tkc > That says the LHS is assigned the RHS rotated by some angle, which I'll assume to be 90 degrees clockwise, yes? Well I don't suppose it really matters for x as it'll still be x when it gets assigned to y, but what would you call the shift on y that gets assigned to x? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence