[SciPy-Dev] requesting code review: added close matches to constants.codata.value()
Nathaniel Smith
njs at pobox.com
Mon Apr 28 09:01:32 EDT 2014
Another option (don't know if it's a good one):
class ConstantKeyError(KeyError):
def __str__(self):
key = self.args[0]
similar = ...
return "Constant %r not found -- perhaps you wanted one of:
%s" % (key, ", ".join(similar))
-n
On Sun, Apr 27, 2014 at 7:51 PM, Kevin Davies <kdavies4 at gmail.com> wrote:
> Thanks. Unfortunately it looks like I can't raise a KeyError with a
> multi-line message. Newlines are printed literally as "\n". Do you
> have any suggestions?
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
--
Nathaniel J. Smith
Postdoctoral researcher - Informatics - University of Edinburgh
http://vorpus.org
More information about the SciPy-Dev
mailing list