interesting exercise

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Tue May 8 00:33:51 EDT 2007


On Tue, 08 May 2007 01:21:37 -0300, Gabriel Genellina wrote:

> if not sorted(values): raise ValueError("unsorted values")

sorted() doesn't return a flag telling if the values are sorted, it 
returns a new list containing values sorted. So this line will raise an 
exception only on an empty sequence.


-- 
Steven.



More information about the Python-list mailing list