[Python-ideas] breaking out of module execution

Georg Brandl g.brandl at gmx.net
Wed Apr 25 21:38:27 CEST 2012


On 25.04.2012 14:43, Mark Shannon wrote:

>> Today, if you successfully import a module, you know that all the 
>> top-level code in that module was executed. If this feature is added, 
>> you cannot be sure what top-level code was reached unless you scan 
>> through all the code above it.
>> [end quote]
> 
> I don't know if this is a good idea or not, but the fact that to it can
> be implemented by removing a single restriction in the compiler suggests
> it might have some merit.

That is a strange argument.  The restriction was placed there for a reason.
(With the same argument you could argue for "None = 1" to be valid code.)

Georg




More information about the Python-ideas mailing list