Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't mind the "try ... except" version for the cases where most of the time the key will be present. Two reasons for this:

1) the "except" semantics help hit home the point you expect the key to be there most of the time

2) in cases where the exception will rarely be raised, the "try ... except" route runs faster than the ".get() ... if" route.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: