for -- else: what was the motivation?
Robert Latest
boblatest at yahoo.com
Mon Oct 10 12:59:27 EDT 2022
Grant Edwards wrote:
> I've followed that advice for several decades. I find it much easier
> to read code that's organized that way -- particularly when the
> difference in block sizes is large (e.g. the first block is one line,
> and the second is a a hundred).
If any conditionally executed blocks is a hundred lines, I believe your code
needs refactoring. I know mine does. Either the long block should go into an
extra function, or you do a "fail and bail" (just learned that phrase).
More information about the Python-list
mailing list