Python paradigms

Nick Maclaren nmm1 at cus.cam.ac.uk
Mon Apr 10 11:30:55 CEST 2000


In article <Pine.LNX.4.21.0004100757580.19783-100000 at fep132.fep.ru>, Oleg Broytmann <phd at phd.russ.ru> writes:
|> On Mon, 10 Apr 2000, Robert W. Cunningham wrote:
|> 
|> > Oleg Broytmann wrote:
|> > > > python's "and" and "or" operators doesn't evaluate the
|> > > > second argument unless they really have to...
|> > >
|> > >    Yes, I missed that, sorry.
|> > 
|> > So, it works just fine, right?
|> 
|>    No. Code is intended not only to beeing run on processor, but also (and
|> often more important) to beeing read by human. Code is speech, it is the
|> way to interchange ideas.
|>    In that sense ugly code is not working even if you add three books of
|> comments. Code should be readable. Period.

Yes, precisely.  In the real world, programs often have long lifetimes,
are worked on by many programmers (in parallel and sequentially), are
sometimes transliterated between languages, and it is common to need
to modify code which was written 20 years ago by some long-retired
programmer.

At best, confusing code wastes effort.  At worst, it causes mistakes
to be introduced.  I have seen the latter effect many times.

That is why I was talking about the benefits of those paradigms for
code clarification, and neither efficiency nor compactness.  Python
has some very useful facilities, but is a bit tedious for some kinds
of scripting.


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email:  nmm1 at cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679



More information about the Python-list mailing list