Author brett.cannon
Recipients Trundle, belopolsky, brett.cannon, cool-RR, giampaolo.rodola, gruszczy, loewis, ncoghlan, nedbat, r.david.murray, techtonik, vstinner
Date 2011-03-16.17:41:46
SpamBayes Score 1.96218e-10
Marked as misclassified No
Message-id <1300297307.05.0.960761430477.issue1559549@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-03-16 17:41:47brett.cannonsetrecipients: + brett.cannon, loewis, ncoghlan, belopolsky, vstinner, techtonik, giampaolo.rodola, nedbat, r.david.murray, Trundle, gruszczy, cool-RR
2011-03-16 17:41:47brett.cannonsetmessageid: <1300297307.05.0.960761430477.issue1559549@psf.upfronthosting.co.za>
2011-03-16 17:41:46brett.cannonlinkissue1559549 messages
2011-03-16 17:41:46brett.cannoncreate