Nick Coghlan added the comment: This is actually similar to the problem with getting the list of modules an importer provides (that is, we don't currently have an officially defined method in the importer protocol for that, although pkgutil.iter_importer_modules implicitly looks for an "iter_modules" method, due to the old import emulation used until Python 3.2).
I see three possibilities: 1. Use independent purpose specific protocols to get a list of entries out of these objects. 2. Create a new, common protocol for extracting lists of entries from search hooks like importers and codec search functions 3. Use the existing __iter__ protocol I'm currently thinking option 3 might be a reasonable way forward. That is, if a codec search hook wants to provide a listing of available codecs, it can just define __iter__ in addition to __call__. Importers could define __iter__ in addition to the other methods in the importer API. Thoughts? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17878> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com