exceptions beyond errors?

Greg Ewing (using news.cis.dfn.de) g2h5dqi002 at sneakemail.com
Tue Jun 10 04:30:29 CEST 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