[Python-ideas] Explicitly shared objects with sub modules vs import
Ron Adam
ron3200 at gmail.com
Tue Jun 2 23:46:13 CEST 2015
On 06/02/2015 04:23 AM, Dennis Kaarsemaker wrote:
> On za, 2015-05-30 at 11:45 -0400, Ron Adam wrote:
>
>> The solution I found was to call a function to explicitly set the shared
>> items in the imported module.
>
> This reminds me of my horrible april fools hack of 2013 to make Python
> look more like perl: http://seveas.net/exporter/
It's the reverse of what this suggestion does, if I'm reading it correctly.
It allows called code to alter the callers frame. Obviously that
wouldn't be good to do.
I think what makes the suggestion in this thread "not good", is that
modules have no formal order of dependency. If they did, then it could be
restricted to only work in one direction, which means sub-modules couldn't
effect parent modules. But python isn't organised that way. All modules
are at the same level. Which means they can import from each other... and
possibly export to each other too. So it's up to the programmer to
restrict what parts effect other parts as if it did have a formal
dependency order.
Cheers,
Ron
More information about the Python-ideas
mailing list