Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!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.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'smallest': 0.07; 'suggest': 0.15; 'computes': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'lukas': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'rotation': 0.16; 'simpson': 0.16; 'wrote:': 0.16; 'element': 0.18; 'do.': 0.22; 'aspect': 0.22; 'cheers,': 0.22; 'needed.': 0.23; 'second': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'subject:list': 0.26; 'compare': 0.27; 'start,': 0.27; 'idea': 0.28; 'fine': 0.28; 'comparison': 0.29; 'point': 0.33; 'clarify': 0.33; 'list': 0.34; 'but': 0.36; 'should': 0.36; 'instead': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'starting': 0.37; 'does': 0.39; 'enough': 0.39; 'easily': 0.39; 'to:addr:python.org': 0.40; 'matter': 0.63; 'is.': 0.63; 'more': 0.63; 'cameron': 0.66; 'equals': 0.66; 'received:61': 0.72; 'walk': 0.72; 'eliminates': 0.93 X-Authentication-Info: Submitted using ID cskk@bigpond.com X-Authority-Analysis: v=2.0 cv=EJGEIilC c=1 sm=1 a=Xl+DAPPvrAuutrzkOAYnNw==:17 a=vrnE16BAAAAA:8 a=ZtCCktOnAAAA:8 a=yEdEr6MRgwAA:10 a=uRRa74qj2VoA:10 a=Q6FeT2ecvh0l6MGZrNIA:9 a=CjuIK1q_8ugA:10 a=Xl+DAPPvrAuutrzkOAYnNw==:117 Date: Sun, 2 Aug 2015 08:25:30 +1000 From: Cameron Simpson To: python-list@python.org Subject: Re: Most pythonic way of rotating a circular list to a canonical point MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) References: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1438468309 news.xs4all.nl 2843 [2001:888:2000:d::a6]:33492 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:94870 On 01Aug2015 14:24, Lukas Barth wrote: >Perhaps I should clarify a bit: >- I definitely need a "canonical rotation" - just a comparison result is not enough Fine. This also eliminates any solution which just computes a hash. >- It does not matter what that rotation is. Starting with the smallest element was just an idea by me, any rotation that can easily produced will do. That's a fine way to start, but more work than is needed. Might I suggest instead simply starting with the leftmost element in the first list; call this elem0. Then walk the second list from 0 to len(list2). If that element equals elem0, _then_ compare the list at that point as you suggested. Is there an aspect of this which doesn't work? Cheers, Cameron Simpson