Need a strange sort method...

Tim Chase python.list at
Mon Oct 16 22:00:33 CEST 2006

>>> that's trivial to do with slicing, of course.  what makes you think you
>>> need to do this by calling the "sort" method ?
>>> </F>
>> You are of course correct.. There might be a way to do this with
>> slicing 
>> and i % 3
> Slicing will work only with a sorted list.

But modulus arithmetic will only work with contiguous, 
non-repeating numeric sequences...Funky things happen with 
sequences like

[1,2,3,4,4,5,6,7,8,9,10] # "4" appears twice



where the position and the numeric value no longer correlate via 
a simple modulus.


More information about the Python-list mailing list