about sort and dictionary

Neil Hodgson nyamatongwe+thunder at gmail.com
Wed Nov 23 23:34:47 CET 2005


Magnus Lycka:

> Except when it isn't obvious. What constitutes mutation of an object?
> C++ handles this with 'const', and lets the programmer cheat by using
> transient member variables, since there are cases when you actually
> want to mutate objects a little, but claim that you don't...

    Ruby uses '!' not for mutation but to indicate surprising or 
destructive mutation. If it was placed on all mutators, code would be 
full of '!'s. '!' is less common on methods that modify the receiver 
than on methods that mutate other arguments.

    There was a recent thread on this in c.l.ruby "Array#insert", 
starting 8 posts down.

    Neil



More information about the Python-list mailing list