andrea crotti <andrea.crott...@gmail.com> writes: > and we want to change its state incrementing the number ... > the immutability purists would instead suggest to do this: > def increment(self): > return NumWrapper(self.number + 1)
Immutability purists would say that numbers don't have "state" and if you're trying to change a number's state by incrementing it, that's not immutability. You end up with a rather different programming style than imperative programming, for example using tail recursion (maybe wrapped in an itertools-like higher-order function) instead of indexed loops to iterate over a structure. -- http://mail.python.org/mailman/listinfo/python-list