D
dhruvbird
Why doesn't python's list append() method return the list itself? For
that matter, even the reverse() and sort() methods?
I found this link (http://code.google.com/edu/languages/google-python-
class/lists.html) which suggests that this is done to make sure that
the programmer understands that the list is being modified in place,
but that rules out constructs like:
([1,2,3,4].reverse()+[[]]).reverse()
I want to prepend an empty list to [1,2,3,4]. This is just a toy
example, since I can always do that with [[]]+[1,2,3,4].
Regards,
-Dhruv.
that matter, even the reverse() and sort() methods?
I found this link (http://code.google.com/edu/languages/google-python-
class/lists.html) which suggests that this is done to make sure that
the programmer understands that the list is being modified in place,
but that rules out constructs like:
([1,2,3,4].reverse()+[[]]).reverse()
I want to prepend an empty list to [1,2,3,4]. This is just a toy
example, since I can always do that with [[]]+[1,2,3,4].
Regards,
-Dhruv.