exceptions beyond errors?
Greg Ewing (using news.cis.dfn.de)
g2h5dqi002 at sneakemail.com
Mon Jun 9 22:30:29 EDT 2003
Terry Reedy wrote:
> This has now been incorporated in the dict.get method so one can
> instead write
>
> x = mydict.get(key, defaultvalue)
But the exception form is still useful if evaluating
defaultvalue is expensive and you only want to do it
if you really need it.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list