On 28.11.2016 23:52, Chris Angelico wrote:
+1, because this also provides a coherent way to reword the try/except
import idiom:
# Current idiom
# somefile.py
try:
import foo
except ImportError:
import subst_foo as foo
# New idiom:
# foo.missing.py
import subst_foo as foo
import sys; sys.modules["foo"] = foo
#somefile.py
import foo
Hmm. I would rather take this example as an argument against the
proposed behavior. It invites too many clever hacks. I thought that the
idea was that .missing.py does *not* act as a replacement module, but,
more or less, just as a message generator.
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/