Brett Cannon <[email protected]> added the comment:
At the PyCon 2011 sprint we discussed this issue and Nick, myself, and some
other people agreed that using a keyword-only argument for passing in the
module name is probably a better solution. While it won't be
backwards-compatible (BaseException does not accept keyword arguments), it does
provide a very clean API with an unambiguous way of specifying the module.
Going another route (e.g., a constructor method) has the same
backwards-compatibility issue. But a reason to use a solution other than the
magical handling of the second argument is that it prevents doing the wrong
thing simply because someone passes two or more arguments to ImportError.
Another nicety of a new API for ImportError is that it can be made such that if
the keyword-only argument ('module_name'?) is the only thing supplied (e.g., no
positional arguments) then the message can be auto-generated, which would be a
nice way to solve issue #8754.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue1559549>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com