[issue15767] add ModuleNotFoundError

Antoine Pitrou report at bugs.python.org
Tue Jul 2 17:01:11 CEST 2013


Antoine Pitrou added the comment:

> In this instance where there are only a set number of options are
> expected to be officially valid, yes I think enums are a good fit.

They are a good fit, that doesn't mean they're the only one.

> As for strings, the only way I would be okay with that is defining
> the strings either as attributes on ImportError itself or off of
> importlib to make it easy to do a comparison.

What does that mean?
I don't understand how `exc.reason == 'module_not_found'` is
harder than `exc.reason == ImportReason.MODULE_NOT_FOUND`.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15767>
_______________________________________


More information about the Python-bugs-list mailing list