<br>If you need the same ordering in two lists, you really should sort the lists - though your comparison function need not be that traditional. You might be able to get away with not sorting sometimes, but on CPython upgrades or using different Python interpreters (Pypy, Jython), it's almost certain the ordering will be allowed to change.<br>
<br>But sorting in a loop is not generally a good thing - there's almost always a better alternative.<br><br><div class="gmail_quote">On Thu, May 3, 2012 at 5:36 PM, Peng Yu <span dir="ltr"><<a href="mailto:pengyu.ut@gmail.com" target="_blank">pengyu.ut@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
list(a_set)<br>
<br>
When convert two sets with the same elements to two lists, are the<br>
lists always going to be the same (i.e., the elements in each list are<br>
ordered the same)? Is it documented anywhere?<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Regards,<br>
Peng<br>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br>