News for hackers. Stuff that matters.
Re:Pissed off about functional programming by jmreardon on Saturday March 26, 2011 @10:30PM (#2373954)
I think the other replies have answered your question well enough, but your definitions for = are a litle off. The cases 1 and 2 are really the same thing. In Python the names are references to objects. Assignment in Python is like using pointers in C. You are doing mutation, what you mutate is the value of a pointer (and probably some other oddsand ends for garbage collection).
Re:Pissed off about functional programming by scott_s on Sunday March 27, 2011 @06:23PM (#2376269)
I was going to say the same thing - that cases 1 and 2 are really the same thing - when I realized that's not quite accurate. In his terms, mutation is a special case of re-assignment. That is, re-assignment allows re-binding a name to an entirely different value which may have a different type. Mutation is then re-assignment where the types happen to be the same.