Loop-and-a-half (Re: Curious assignment behaviour)
David Bolen
db3l at fitlinxx.com
Thu Oct 11 17:13:07 EDT 2001
Dale Strickland-Clark <dale at riverhall.NOSPAMco.uk> writes:
> Not so. It can avoid an extra enclosing block in cases such as:
>
> if (x==y)
> for (initialise loop; ....)
> do something
>
> Which is less fussy than
>
> if (x==y)
> { initialise loop
> for (....)
> do something
> }
Except that I'd never recommend writing the former (initialization or
not) since you're just asking for maintenance headaches later when
someone tries to add a new statement to the conditional and forgets to
add the block back in.
--
-- David
--
/-----------------------------------------------------------------------\
\ David Bolen \ E-mail: db3l at fitlinxx.com /
| FitLinxx, Inc. \ Phone: (203) 708-5192 |
/ 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \
\-----------------------------------------------------------------------/
More information about the Python-list
mailing list