boblatest: > I have a long list of memory-heavy objects that I would like to access > in differently sorted order. Let's say I'd like to have lists called > by_date or by_size that I can use to access the objects in the > specified order.
Just create a new list with a different sorting order, for example using: from operator import attrgetter by_date = sorted(input_data, key=attrgetter("date")) by_size = sorted(input_data, key=attrgetter("size")) Python doesn't copy by value by default, so you end having just a light list of references. To understand the situation better, there's a FAQ about how Python associates names to things. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list