Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Immutability and Python
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
andrea crotti  
View profile  
 More options Oct 29 2012, 11:44 am
Newsgroups: comp.lang.python
From: andrea crotti <andrea.crott...@gmail.com>
Date: Mon, 29 Oct 2012 15:44:31 +0000
Local: Mon, Oct 29 2012 11:44 am
Subject: Re: Immutability and Python
2012/10/29 Jean-Michel Pichavant <jeanmic...@sequans.com>:

> "return NumWrapper(self.number + 1) "

> still returns a(nother) mutable object.

> So what's the point of all this ?

> JM

Well sure but it doesn't modify the first object, just creates a new
one.  There are in general good reasons to do that, for example I can
then compose things nicely:

num.increment().increment()

or I can parallelize operations safely not caring about the order of
operations.

But while I do this all the time with more functional languages, I
don't tend to do exactly the same in Python, because I have the
impression that is not worth, but maybe I'm wrong..


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.