Christoph Groth <[email protected]> added the comment:
Thank you, Chris, for your reply. If this is indeed the main use case of
ModuleNotFoundError, I respectfully suggest to document it better. The way
things are now, Python users who switch to 3.6 encounter this new exception
during their work with the interpreter and invariably wonder "Should I change
anything in my code because of this? If not, why was it introduced?". In my
opinion the current documentation does not answer these questions well. Note
that this is not about some deeply buried detail. Every Python programmer is
bound to encounter this.
That said, I cannot imagine many cases where user code would like to fall back
to html.parser only if fancy_parser is not installed but not if an older
version of fancy_parser is installed (or maybe it's an entirely *different*
fancy_parser?). And in the rare cases where that is desired, it was already
perfectly idiomatic to do so:
try:
import fancy_parser
except ImportError:
from html.parser import HTMLParser
else:
from fancy_parser import NewParser as HTMLParser
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue15767>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com