Corey Richardson wrote:
Tutors,

I recall that the keys of dictionaries have arbitrary order, and may change over time. Is this true of lists? I can't find the answer from a simple Google search. Thank you!

Only if you re-arrange it yourself.

list.sort(), list.reverse() and random.shuffle(list) explicitly change the list's order. You can also manually move items around, e.g.:

list[3], list[5] = list[5], list[3]  # swap items 3 and 5

but otherwise lists keep their order.


--
Steven
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to