[Python-ideas] breaking out of module execution
ron3200 at gmail.com
Wed Apr 25 18:06:23 CEST 2012
On 04/24/2012 03:15 PM, Mark Shannon wrote:
> This has to be the only few feature request that can implemented by
> removing code :)
> I implemented this by deleting 2 lines of code from the compiler.
Does it also allow returns in class bodies when you do that?
>>> class A:
File "<stdin>", line 2
SyntaxError: 'return' outside function
Weather or not it does. I think modules are closer to class bodies and
return should be a syntax error in that case as well. They aren't
functions and we shouldn't think of them that way. IMHO It would make
Python harder to learn when the lines between them get blurred.
More information about the Python-ideas