converting a set into a sorted list

MackS mackstevenson at hotmail.com
Sat May 14 21:31:41 EDT 2005


Dear all,

I've got several large sets in my program. After performing several
operations on these I wish to present one set to the user [as a list]
sorted according to a certain criterion. Is there any direct way to do
so? Or must I

list = []

for item in set1:
   list.append(item)

list.sort(....)

Can I somehow avoid doing this in two stages? Can I somehow avoid first
creating a long list only to immediately sort it afterwards?

Thanks for any guidance,

Mack




More information about the Python-list mailing list