Furthermore, if in Python the algorithm for the reverse function applies to many kinds of objects, it just needs to be coded once, whereas a reverse method would have to provided for each class that uses it (perhaps through inheritance).
Indeed, this is why Python not only provides the list.reverse() method to reverse a list in place, but also provides the reversed() function to reverse any sequence:
Py> lst = list("ABCDEFGHIJ") Py> lst.reverse() Py> print "".join(lst) JIHGFEDCBA Py> print "".join(reversed(lst)) ABCDEFGHIJ
Ditto list.sort() and sorted().
Cheers, Nick.
-- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list