> > I suggest we keep imp.find_module but add another argument: > > > > find_module(name [, path [, suffixes]]) > > > > where suffixes defaults to imp.get_suffixes(). This enables it > > to be used to search for files with different suffixes, for > > example suffixes=[".conf"]. > > I'm not sure if I like this: imp.find_module() is designed for finding > modules, not arbitrary files. It's an interesting idea though, but this > would neccesarily complicate the importer protocol, as each importer > would have to deal with arbitrary suffixes. It implies file-system > semantics that importer objects can't neccesarily satisfy, eg. an > importer doesn't neccesarily deal with suffixes at *all*. I also found this an interesting idea, first. But then, how would this (working) code have to be written with the new imp.find_module() function: def get_exe_bytes (self): # wininst.exe is in the same directory as this file directory = os.path.dirname(__file__) filename = os.path.join(directory, "wininst.exe") return open(filename, "rb").read() Thomas
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4