Chris Jerdonek <chris.jerdo...@gmail.com> added the comment:

As someone who isn't an expert on Python's import mechanisms, I'm confused by 
this comment at the end of pkgutil.walk_packages():

"Note: Only works for importers which define a iter_modules() method, which is 
non-standard but implemented by classes defined in this module."

I'm confused because importers aren't mentioned anywhere in the context of 
walk_packages() (in particular, `importer` is not a parameter to the function), 
so it's not clear to me how the note comes into play.

For example, is "importers" in reference to the import statements inside the 
modules in the package that one is trying to walk, or is it a reference to 
whether or not the user has overridden Python's standard import with a custom 
import function?

In particular, does this mean that the normal case of trying to walk a 
directory using `pkgutil.walk_packages(['my_dir'])` won't work without doing 
something special, and if so, can that special thing be added?

I think it would help if this were made clearer.  I came to this after trying 
to start working on issue 14787.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14982>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to