[Python-ideas] breaking out of module execution

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 26 01:24:50 CEST 2012


M.-A. Lemburg wrote:

> People don't appear to have a problem with this in long functions
> or methods, so I'm not sure how well that argument qualifies.

Well, I have a problem with long functions whether they
have embedded returns or not.

But another difference is that functions usually consist
of a set of related statements that need to be read in
order from top to bottom. Modules, on the other hand,
typically consist of multiple relatively small units
whose order mostly doesn't matter. Sticking a return
in the middle introduces an unexpected ordering
dependency.

-- 
Greg



More information about the Python-ideas mailing list