[Python-ideas] breaking out of module execution
Georg Brandl
g.brandl at gmx.net
Wed Apr 25 21:31:05 CEST 2012
On 25.04.2012 17:52, Ron Adam wrote:
> Think of modules as a type of class where ...
>
> import module
>
> is equivalent to ...
>
> module module_name:
> <module file contents here>
>
> Like classes the module body would execute to define the module, and return
> inside the module body would be a syntax error.
No, sorry, that's not a good equivalence. It reinforces the impression some
people have of "import" working like "#include" in C or (God forbid) "require"
in PHP.
Georg
More information about the Python-ideas
mailing list