In commons_information.py

try:
    import mwparserfromhell
except ImportError as e:
    mwparserfromhell = e

try:
    import langdetect
except ImportError:
    langdetect = None

Later it examines
        if isinstance(mwparserfromhell, Exception):
            raise mwparserfromhell

Why is it good to delay in such complicated way? Why does not handle the script the error at once?

I want to invent a script dealing with tables. It could be used directly with simple arguments and imported in order to use advanced functions. What is the good way of handling import error? I don't like this mismatch that mwparserfromhell is either a module or an Exception, is there any advantage of this solution?
--
Bináris