about sort and dictionary
lycka at carmen.se
Wed Nov 23 14:18:42 CET 2005
bonono at gmail.com wrote:
> Alex Martelli wrote:
>>bonono at gmail.com <bonono at gmail.com> wrote:
>>>intuitive seems to be a very subjective matter, depends on once
>>>background etc :-)
>>That's a strong point of Ruby, actually -- allowing an exclamation mark
>>at the end of a method name, which conventionally is always used to
>>indicate that the method is a mutator. So, you can have a.reverse [NOT
>>mutating a since no !] _and_ a.reverse! [mutating a]. Probably too much
>>of a change even for Python 3000, alas... but, it DOES make it obvious
>>when an object's getting mutated, and when not...
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...
Perhaps we need a.reverse? for just-mutating-a-little reverse as well?
More information about the Python-list