[Ilugc] Python list.reverse()

  • From: lawgon@xxxxxxxxxxxxxxx (Kenneth Gonsalves)
  • Date: Fri, 18 Feb 2011 13:04:06 +0530

On Fri, 2011-02-18 at 12:46 +0530, Vinod Parthasarathy wrote:

Note that the numbers list has not changed even after calling
'reverse'
method.

The general consensus is that mutability is bad for programming.
YMMV.


There is both a bad and a good side to mutability. Mutability can give
rise
to faster running programs than their immutable counterparts in
certain
situations. Space complexity is also reduced in mutable programs. The
downside is that programming becomes error-prone and additional care
is
needed on the programmer's part. 

well, in python lists and dictionaries are mutable, strings and tuples
are not. I like it. One can do a hell of a lot of good fast stuff with
it. In fact, I cannot really imagine using a immutable list. 
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/


Other related posts: