Re: My other pet python peeve - .sort(),.reverse(), etc. return None

Mats Lidell (Mats.Lidell@eua.ericsson.se)
Wed, 15 Sep 93 12:53:54 +0200

>>>>> Steven recently wrote:

Steven> I don't think it bugs me THAT much, that I'ld become an
Steven> island among python users. ( Any idea how many of us there
Steven> are? )

Huh... There must be a few others on this list beside you guys. ;-)

Well I'm one but I usually only write a script or two the period of a
half year. So it is really hard to level with you on these types of
detailed discussion. But here goes anyway ...

Steven> [ Although, I might be tempted to try it as an experiment,
Steven> to see HOW many pieces of code the change might actually
Steven> break, and how badly. ]

This is a conseptioal problem.

As I view (e.g what the gurus brainwashed me to think :-) the OO-world
is that it is convenient to think about two kinds or operations that
manipulate the objects, Procedures and Functions. Functions return
some value but does not change the object and with Procedures it is
the opposit. They do not return any value but do indeed manipulate the
objekt into a new state.

I don't know how stringent this is kept in python but at least I like
it. So the solution to Stevens problem would not be to change sort
into provide both services but rather to introduce another "function"
that would return the sorted value but would not change the
originating object.

%% Mats