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.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'programmer': 0.03; 'variables': 0.07; 'subject:number': 0.09; '-tkc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'roy': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'header:In-Reply-To:1': 0.27; 'subject:list': 0.30; 'asked': 0.31; 'fine,': 0.31; 'hacker': 0.31; 'subject:the': 0.34; 'knows': 0.35; 'something': 0.35; 'charset:us-ascii': 0.36; 'writes': 0.38; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'such': 0.63; 'smith': 0.68; 'subject:get': 0.81; 'received:50.22': 0.84 Date: Mon, 11 Aug 2014 07:30:04 -0500 From: Tim Chase To: python-list@python.org Subject: Re: how to get the ordinal number in list 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> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com X-Get-Message-Sender-Via: boston.accountservergroup.com: authenticated_id: tim@thechases.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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407760299 news.xs4all.nl 2851 [2001:888:2000:d::a6]:58772 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76053 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