[Python-Dev] PEP 463: Exception-catching expressions
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Mar 6 06:47:28 CET 2014
Steven D'Aprano wrote:
> Return the value for key if key is in the dictionary, else default.
> If default is not given, it defaults to None, so that this method
> never raises a KeyError.
I think that's supposed to mean that it won't raise
KeyError as a result of the key not being in the
dictionary. The actual behaviour is correct, IMO,
because it avoids masking bugs, so this could probably
be worded better.
--
Greg
More information about the Python-Dev
mailing list