I think the OO way is slightly more obscure. It's obvious what x = reverse(x) does, but it is not clear unless you have the source code whether x.reverse() reverses x or if it returns a reversed list. If x.reverse() does the former, a disadvantage relative to the procedural approach is that a function can be used in an expression. It is clearer and more concise to write
Sure, it's clear if in written code you see
x = reverse(x)
To me it would also be clear to see
x.reverse()
But what if you just see in some list that there is a reverse(sequence) function, or that a sequence has a reverse() method? To me, neither of these is clear. Do they return a new, reversed sequence or reverse in place?
When creating a new API, I would probably use a convention where reverse does it in place and reversed returns a new. So, in my API,
reverse(x) y = reversed(x) x.reverse() y = x.reversed()
-- Timo Virkkala -- http://mail.python.org/mailman/listinfo/python-list