Grouping code by indentation - feature or ******?

Ivan Van Laningham ivanlan at pauahtun.org
Fri Mar 25 11:39:07 EST 2005


Hi All--

Larry Bates wrote:
> 
> Secondly,  Python "nudges" me into writing better
> (easier to maintain and clearer to understand) code by
> influencing me towards splitting my code into smaller
> functions/classes.  If I find myself with more than 3-4
> levels of indentation, I probably need to move some of the
> lower level code into a function or a class anyway (I
> actually ran into this this very morning). Some might
> interpret this as a negative, I don't.  I find that a lot
> of programmers put WAY too much code into single individual
> modules (main programs, functions) for their own good.

Agreed.  Any method where you have to scroll to figure out what matches
what is _too big_.  This principle holds true for any language.  Keeping
to that aesthetic forces you to modularize your code and often generates
far more flexible functions/methods than you would have any right to
expect otherwise.

As far as grouping by indentation goes, it's why I fell in love with
Python in the first place.  Braces and so on are just extraneous cruft
as far as I'm concerned.  It's the difference between Vietnamese verbs
and Latin verbs;-)

Metta,
Ivan
----------------------------------------------
Ivan Van Laningham
God N Locomotive Works
http://www.andi-holmes.com/
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours



More information about the Python-list mailing list