On 25 Apr, 2012, at 14:11, Mark Shannon wrote:
Steven D'Aprano wrote:
[snip]
Unless you address the disadvantages and costs of top level return, you won't convince me, and I doubt you will convince many others.
What costs?
Harder to understand code is one disadvantage. The "return" that ends execution can easily be hidden in a list of definitions, such as ... some definitions ... if sys.platform != 'win32': return ... more definitions for win32 specific functionality ... That's easy to read with a 10 line module, but not when the module gets significantly larger. Also, why use the proposed module-scope return instead of an if-statement with nested definitions, this works just fine: : def foo(): pass : : if sys.platform == 'linux': : : def linux_bar(): pass
_______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas