On Mar 20, 5:08 pm, grocery_stocker <cdal...@gmail.com> wrote:
> On Mar 20, 8:34 am, Paul McGuire <pt...@austin.rr.com> wrote:
>
> > On Mar 20, 9:54 am, "thomasvang...@gmail.com"
>
> > <thomasvang...@gmail.com> wrote:
> > > You could use:
> > > B=list(set(A)).sort()
> > > Hope that helps.
> > > T
>
> > That may hurt more than help, sort() only works in-place, and does
> > *not* return the sorted list.  For that you want the global built-in
> > sorted:
>
> Okay,if sort() only works in-place, then how come the following seems
> to return a sorted list
>
>
>
> >>> f = [9,7,6,8]
> >>> g=f
> >>> g
> [9, 7, 6, 8]
> >>> g.sort()
> >>> g
> [6, 7, 8, 9]
> >>> f
> [6, 7, 8, 9]
>
> Ie, when I sort g, f also seems to get sorted.

Wait. Never mind.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to