On Fri, 10 Dec 1999, Gordon McMillan wrote:
... If the user imports foo.spam.bar, an importer will be asked for: foo (return foo.__init__) foo.spam (return foo.bar.__init__)
foo.spam.bar (return foo.spam.bar)
The above sequence is what currently happens.
But the API allows lots of variations. This is another possible interaction: foo (return None) foo.__init__ (return foo.__init__) foo.spam (return None) foo.bar.__init__ (return foo.bar.__init__) foo.spam.bar (return foo.spam.bar)
The core of imputil has no knowledge of the __init__ thingy. That is specific to the filesystem-based stuff. So in this sense, "possible" means "imputil could be changed to do this". I would argue against the change, however :-)
Or, by looking at different args to get_code, you could look at the requests as: foo in context of None spam in context of foo bar in context of foo.spam