Stephen Kellett wrote: > In message <[EMAIL PROTECTED]>, Carl > Banks <[EMAIL PROTECTED]> writes >> Stephen Kellett wrote: >> I don't really understand how a closing brace helps here. Care to >> explain why it helps you? > >> (Deeply nested long functions are evil anyways. If you have such a > > I didn't write deeply nested. I wrote multiple levels of indentation. > They are not the same thing (they can be, but they don't have to be). A > lot of code gets to 3 or 4 levels of indentation quite easily. I > wouldn't call that deeply nested, not by a long shot. > > To answer your first question: In C++/Ruby/Pascal you'd have something > like this > > function() > { > loop1() > { > blah > blah > > loop2() > { > blah > > loop3() > { > blah > } > > blah > } > } > > otherloop() > { > blah > } > } > > and in Python that gets to > > function() > loop1() > blah > blah > > loop2() > blah > > loop3() > blah > > blah3 > > otherloop() > blah > > I really dislike that the end of loop2 is implicit rather than > explicit.
<nitpicking> Well, one can argue that since Python grammar defines that a code block ends with the first following non-blank line that one indentation level less, it's perfectly explicit !-) </nitpicking> But practically speaking : > If its implicit you have to look for it. Indeed. And yes, I agree that it's not that good wrt/ readability for any complex or long block. OTOH, nothing prevents you to add a "# end <block>" comment where appropriate - FWIW, I used to do it in C after the closing brace for any lengthy block (and code blocks tend to be longer in C than in Python). -- http://mail.python.org/mailman/listinfo/python-list