Quantcast
Channel: Use exception as check - is it good idea? - Stack Overflow
Browsing all 4 articles
Browse latest View live

Answer by 5gon12eder for Use exception as check - is it good idea?

The Python – unlike most of the rest of the world – people actually encourage this use of exceptions.They call it the EAFP principle, quoting American computer scientist and United States Navy rear...

View Article



Answer by kuma DK for Use exception as check - is it good idea?

Exceptions are not for checking.it should be used as last option if you are unable to deal with some run time issue. Most probably to catch any unexpected but foreseen issues while running. ex- db...

View Article

Answer by Karl M.W. for Use exception as check - is it good idea?

The general rule I operate by is:Do you expect it to pass?If I expect an action will be successful most of the time, I use exceptions.If I expect an action to fail most of the time, I'll intercept it...

View Article

Use exception as check - is it good idea?

I have code: print('Adding user %s...' % user) # my own class with method sysacts.useradd() # check if user exist after been added try: pwd.getpwnam(user) print('Done.') except KeyError as e:...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>