[Python-ideas] breaking out of module execution
ncoghlan at gmail.com
Wed Apr 25 07:33:54 CEST 2012
On Wed, Apr 25, 2012 at 10:55 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> In my opinion, this is an attractive nuisance.
> -1 on the feature.
Agreed (and my preferred idiom for all the cited cases is also "always
define the Python version, override at the end with the accelerated
Although, if we *did* do it, I think allowing "return" at module level
would be the way to proceed (as Mark Shannon noted, that's only
*disallowed* now because the compiler specifically prevents it. The
eval loop itself understands it just fine and ceases execution as soon
as it encounters the relevant bytecode. It isn't quite as simple as
just deleting those lines though, since we likely still wouldn't want
to allow return statements in class bodies).
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas