"MackS" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Can I somehow avoid doing this in two stages? Can I somehow avoid first
> creating a long list only to immediately sort it afterwards?

Yes, you could interatively extract and append the min of the set 
(selection sort), but this would be O(n**2), like bubble or insert sort, 
instead of the O(n*logn) of make list and sort.  You can do the latter in 
two statements without append:
 display = list(big_set)
 display.sort().

As Robert noted, this can be condensed to one using sorted, but that will 
do the same as the two lines above.

Terry J. Reedy



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to