This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cwg
Recipients Arfrever, Guido.van.Rossum, asvetlov, barry, brett.cannon, chris.jerdonek, cvrebert, cwg, eric.snow, ezio.melotti, gvanrossum, jcea, pitrou, python-dev, serhiy.storchaka, theller
Date 2018-02-27.13:13:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1519737221.33.0.467229070634.issue15767@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2018-02-27 13:13:41cwgsetrecipients: + cwg, gvanrossum, barry, brett.cannon, theller, jcea, pitrou, ezio.melotti, Arfrever, cvrebert, asvetlov, chris.jerdonek, python-dev, eric.snow, serhiy.storchaka, Guido.van.Rossum
2018-02-27 13:13:41cwgsetmessageid: <1519737221.33.0.467229070634.issue15767@psf.upfronthosting.co.za>
2018-02-27 13:13:41cwglinkissue15767 messages
2018-02-27 13:13:41cwgcreate