Message207337
Is it the case that given a filename, it might be possible to load a module even if open(filename) fails?
I think the logic is clearer in the form where it is not pulled out into a separate helper function. You can avoid the double check on the extension by doing:
if filename.endswith(importlib.machinery.BYTECODE_SUFFIXES):
loader = importlib.machinery.SourcelessFileLoader('__temp__',
filename)
elif filename.endswith(importlib.machinery.EXTENSION_SUFFIXES):
loader = importlib.machinery.ExtensionFileLoader('__temp__',
filename)
else:
loader = None
if loader:
xxxxx
else:
xxxxx |
|
Date |
User |
Action |
Args |
2014-01-05 03:15:09 | r.david.murray | set | recipients:
+ r.david.murray, brett.cannon, ncoghlan, vstinner, larry, eric.snow |
2014-01-05 03:15:09 | r.david.murray | set | messageid: <1388891709.3.0.34224301299.issue20123@psf.upfronthosting.co.za> |
2014-01-05 03:15:09 | r.david.murray | link | issue20123 messages |
2014-01-05 03:15:09 | r.david.murray | create | |
|