Sorting without transitivity

Frank Niessink frank at niessink.com
Thu May 1 05:13:42 EDT 2003


On Tue Apr 29 22:21:11 2003, Anton Vredegoor wrote:
> 
> There's probably an indentation error at the last else clause. However
> the code happily runs, and pychecker doesn't complain about it either.
> If I "correct" the indentation the code goes into an endless loop for
> a simple test like:
> 
> print tlist([1,2,3])

There is no indentation error. In Python, for loops can have an else
clause. The else clause is executed if the for loop is completed.
If the for loop is exited with a break statement the else clause is
not performed.

Cheers, Frank

-- 
Ford Prefect was desperate that any flying saucer at all would arrive soon 
because fifteen years was a long time to get stranded anywhere, particularly 
somewhere as mindboggingly dull as the Earth.
	-- Douglas Adams, 'The Hitch Hiker's Guide to the Galaxy'





More information about the Python-list mailing list