On Mon, Nov 28, 2016 at 6:00 PM, Wolfgang Maier < wolfgang.ma...@biologie.uni-freiburg.de> wrote:
> 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. > > Is there a reason we need a full-blown message generator? Why couldn't there just be a text file, and the contents of that text file are used as the error message for an ImportError?
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/