[Python-Dev] python3k : imp.find_module raises SyntaxError

Nick Coghlan ncoghlan at gmail.com
Wed Dec 1 02:19:52 CET 2010

On Wed, Dec 1, 2010 at 8:48 AM, Ron Adam <rrr at ronadam.com> wrote:
> * It almost seems like the concept of a sub-module (in a package) is flawed.
>  I'm not sure I can explain what causes me to feel that way at the moment
> though.

It isn't flawed, it is just a *lot* more complicated than most people
realise (cf. PEP 302).

In this case, the signature of find_module (returning an already open
file) is unfortunate, but probably necessary given the way the import
internals currently work. As Brett says, returning a loader would be
preferable, but the builtin import machinery doesn't have proper
loaders defined (and won't until we manage to get to the point where
importlib *is* the import machinery).


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

More information about the Python-Dev mailing list