interesting exercise

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue May 8 00:41:11 EDT 2007


En Tue, 08 May 2007 01:33:51 -0300, Steven D'Aprano  
<steven at REMOVE.THIS.cybersource.com.au> escribió:

> 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.

Ouch!

-- 
Gabriel Genellina




More information about the Python-list mailing list