[Python-ideas] breaking out of module execution

Steven D'Aprano steve at pearwood.info
Wed Apr 25 18:58:28 CEST 2012


M.-A. Lemburg wrote:
> Ronald Oussoren wrote:
>> 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
> 
> Because this only works reasonably if you have a few lines of code
> to indent. As soon as you have hundreds of lines, this becomes
> both unreadable and difficult to edit.

I think that is wrong. Why would hundreds of lines suddenly become unreadable 
and hard to edit because they have a little bit of leading whitespace in front 
of them?


-- 
Steven




More information about the Python-ideas mailing list