allowing braces around suites

Kjetil Torgrim Homme kjetilho at
Thu Sep 2 19:35:32 CEST 2004

[Jeremy Bowers]:
>   Keep writing your spaghetti code, and don't wait for Python to
>   help you code that way. Good luck.

what basis do you have for this characterisation?  have you seen any
examples of Antoon's code?  I'm curious how you can call deeply (how
deep is deep?) nested code "spaghetti code", the flow through such
code is almost always obvious.  adding layers of functions, on the
other hand, can very well introduce the spaghetti feeling.  getting
abstractions right can be hard, and sometimes it might be better to
simply add end markers instead.

I'm sure everyone here agrees that the ideal is to write short
functions (so they fit comfortably on a single page) and to limit the
number of indentation levels.  I'd say more than five[1] levels should
be avoided.  still, I'm not dogmatic about it.  sometimes the more
readable solution is to indent more deeply than recommended.  or it
would be more readable, if end markers were used in that code :-)

[1] keep in mind that "class" and "def" are two levels which are all
    but mandatory.
Kjetil T.

More information about the Python-list mailing list