[issue17030] strange import visibility

R. David Murray report at bugs.python.org
Fri Jan 25 14:21:57 CET 2013


R. David Murray added the comment:

I agree that this is not immediately intuitive.

What you need to know is that modules are part of the global state.  When b imports dbus.mainloop.glib, it affects the global state of the module dbus, causing mainloop.glib to be defined when 'a' references it.

The fact that modules are global state is inherent in Python's design, and is the reason that "monkey patching" works.

----------
nosy: +r.david.murray
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17030>
_______________________________________


More information about the Python-bugs-list mailing list