about sort and dictionary

Magnus Lycka lycka at carmen.se
Thu Nov 24 12:54:01 EST 2005


Alex Martelli wrote:
> I don't think these headaches and difficulties justify dumping the whole
> field of reasoning about programs, nor the subfield of PbC.  The concept
> of "immutable" is really just a tiny corner of these fields, and it's a
> long way from being the hardest or most problematic one in them;-).

Agreed. I also think that it's good practice to make methods do *one*
thing, so when methods grow into both changing state and returning
some substantial value, I usually split them. While the distinction
between "functions" and "procedures" to speak Pascalese is a useful
guidline at times, it's still a generalization though, and I doubt
that it's very useful to have a syntactic marker for this distinction
such as e.g. Pascal has.

As I understand it, Ruby's "!" isn't quite like "procedure" in Pascal,
or "not const" in C/C++, but rather a marker for surprising behaviour,
and while it might be wise to acknowledge that not all APIs are
perfect, it seems difficult to know where mutating behaviour will
surprise users. It seems to me that different programmers have
different expectations on such things, and stumble over completely
different things...



More information about the Python-list mailing list