First python program, syntax error in while loop

Chris Angelico rosuav at gmail.com
Tue May 7 09:29:57 EDT 2013


On Tue, May 7, 2013 at 10:44 PM, Ombongi Moraa Fe
<moraa.lovetakes2 at gmail.com> wrote:
> My first language was Pascal. It was at a time in 2005 when computers were
> finally becoming popular in Africa and our year was the first time a girls
> school from our Province did a computer coursework for National Exams. (That
> was such an achievement *sigh*)
>
> "The teacher said ... Good Programming Practice ... Use parentheses to
> format code.. or I will deduct a point from your work when I feel like it."
>
> Cant seem to let go of the behavior. I use parentheses in all languages.

Pretty much all such blanket advice is flawed. I cannot at present
think of any example of a "Good Programming Practice" suggestion that
doesn't have its exceptions and caveats. The only ones that don't are
the ones that get codified into language/syntax rules, and even there,
most of them have their detractors. Python's indentation rule is a
prime example; most people follow the advice to always indent blocks
of code, Python makes it mandatory, and some people hate Python for
it. (And yes, there have been times when I've deliberately misindented
a block of C code, because it made more logical sense that way. I can
quote examples if you like.)

The only principle that you should follow is: Think about what you're
doing. Everything else is an elaboration on that. [1]

ChrisA
[1] Matthew 22:37-40 :)



More information about the Python-list mailing list