Most pythonic way of rotating a circular list to a canonical point

Emile van Sebille emile at fenx.com
Sat Aug 1 17:29:13 EDT 2015


On 8/1/2015 2:12 PM, Lukas Barth wrote:
> On Saturday, August 1, 2015 at 10:51:03 PM UTC+2, Emile van Sebille wrote:
>> Is the problem to determine if one list of circular numbers 'matches'
>> another one despite rotation status?  If so, I'd do something like:
>
> Well.. no. I actually really need this "canonical" rotation, since I'm hashing this, returning it to other parts of the software, etc..

Then I'm not sure that I understand what exactly the problem is.  Can 
you state it in terms of what you start with and what you expect to get?

The only clue I see is "Now I want to rotate these to a well defined 
status, so that I can can compare them."  Which is where I understood 
you to want to compare them.

You might check at http://www.catb.org/esr/faqs/smart-questions.html

Emile





More information about the Python-list mailing list