Express What, not How.

MetalOne jcb at iteris.com
Wed Oct 15 14:05:16 EDT 2003


Raffael Cavallaro 

I don't know why but I feel like trying to summarize.

I initially thought your position was that lambdas should never be
used.  I believe that Brian McNamara and Ken Shan presented powerful
arguments in support of lambda.  Your position now appears to have
changed to state that lambdas are ok to use, but their use should be
restricted.  One point would appear to desire avoiding duplicate
lambdas.  This makes sense.  Duplication of this sort is often found
in "if statment" conditional tests also.  The next point would be to
name the function if a good name can be found.  I believe that
sometimes the code is clearer than a name.  Mathematical notation was
invented because natural language is imprecise.  Sometimes a name is
better than the code.  The name gives a good idea of the "how" and
perhaps you can defer looking at the "how".  Sometimes I think using
code in combination with a comment is better.  A comment can say a
little more than a name, and the code gives the precision.  So as
Marcin said, it is a balancing act to create readable code.

I would like to say that I have found this entire thread very
comforting.  I have been programming for 18 years now.  For the most
part, when I read other peoples code I see nothing but 300+ line
functions.  I have come to feel like most programmer's have no idea
what they are doing.  But when you're writing small functions and
everybody else is writing 300+ line functions you begin to wonder if
it is you that is doing something wrong.  It is nice to see that other
people actually do think about how to write and structure good code.




More information about the Python-list mailing list