[Python-ideas] Explicitly shared objects with sub modules vs import

Nick Coghlan ncoghlan at gmail.com
Mon Jun 1 08:37:27 CEST 2015

On 1 June 2015 at 13:55, Ron Adam <ron3200 at gmail.com> wrote:
> Of course, it could just be my own preferences.  I like the pattern of
> control (the specifying of what gets imported/shared) flowing from the top
> down.

This is actually how we bootstrap the import system in 3.3+ (we inject
the sys and os modules *after* the top level execution of the
bootstrap module is done, since the "import" statement doesn't work
yet at the point where that module is running).

However, this trick is never a desirable answer, just sometimes the
least wrong choice out of multiple bad options :)


P.S. Python 3.5 is also more tolerant of circular imports than has
historically been the case: https://bugs.python.org/issue17636

Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list