Sorting a list

Aaron Ginn aaron.ginn at motorola.com
Fri Jun 2 15:59:30 EDT 2000


Shae Erisson <shapr at uab.edu> writes:

> Aaron Ginn wrote:
> > 
> > I'm a python newbie, so please be kind! :)
> > 
> > I'm trying to sort a list.  Fairly simple, but I'm not getting
> > at all what I expect.  When I attempt to sort the list, the
> > return value is None, and I can't understand why at all.
> <snip>
> > Why is sort returning an empty list?
> 
> because in this case, sort is expected to have the side effect of
> sorting the list, rather than returning a sorted list.
> 
> >>> a = [3,2,1]
> >>> a.sort()
> >>> a
> [1, 2, 3]
> -- 
> sHae mAtijs eRisson (sHae at wEbwitchEs.coM) gEnius fOr hIre
>    bRing mE fIve sQuirrels aNd nO oNe wIll gEt hUrt

Shae,

Thank you for making that distinction.  That is much clearer now.

Aaron

-- 
Aaron J. Ginn

Opinions mine, not Motorola's



More information about the Python-list mailing list