A defense for bracket-less code
Dave Hansen
iddw at hotmail.com
Wed Apr 26 11:15:45 EDT 2006
On Wed, 26 Apr 2006 10:20:57 -0400 in comp.lang.python, Don Taylor
<nospamformeSVP at gmail.com> wrote:
>Found in a style guide (http://www.artlogic.com/careers/styleguide.html)
>-----------------------------------------------------------------------
>Another case where "unnecessary" braces should be used is when writing
>an empty while loop:
>
>while (*p++ = *q++)
>{
> // this loop intentionally left empty...
>}
FWIW, I usually code this like
while (*p++ = *q++)
continue;
>
>instead of the form that is more commonly found:
>
>while (*p++ = *q++);
PC-lint picks this up (as well as the erroneous code in the elided
example), but will allow the "continue" form shown above.
[...]
>loop exactly once. Python programmers can stop chuckling now.
>-----------------------------------------------------------------------
On 26 Apr 2006 07:54:38 -0700 in comp.lang.python,
"aurelien.campeas at free.fr" <aurelien.campeas at free.fr> wrote:
>wrong group
Not really. It was mostly a lead-in to that last sentence. Problems
like this couldn't happen in Python. So it's an opportunity to get a
giggle at the expense of programmers using a language that gives you
enough rope to shoot yourself in the foot...
Regards,
-=Dave
--
Change is inevitable, progress is not.
More information about the Python-list
mailing list