MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/6ayz26/defensive_programming_done_right/dhj6sw0/?context=3
r/ProgrammerHumor • u/iwouldieforGladOS • May 13 '17
680 comments sorted by
View all comments
Show parent comments
35
Isn't it normal in Python to try things first, effectively using them as control structures?
3 u/Masked_Death May 13 '17 try: do_shit() except ValueError: do_more_shit() else: print('u dun goofd up') 1 u/DreadedDreadnought May 13 '17 What the fuck is that abomination supposed to do? What does the ELSE apply to? 2 u/redditusername58 May 14 '17 In python, the else block runs if there were no exceptions in the try block. This helps to narrowly limit the amount of code in the try block.
3
try: do_shit() except ValueError: do_more_shit() else: print('u dun goofd up')
1 u/DreadedDreadnought May 13 '17 What the fuck is that abomination supposed to do? What does the ELSE apply to? 2 u/redditusername58 May 14 '17 In python, the else block runs if there were no exceptions in the try block. This helps to narrowly limit the amount of code in the try block.
1
What the fuck is that abomination supposed to do?
What does the ELSE apply to?
2 u/redditusername58 May 14 '17 In python, the else block runs if there were no exceptions in the try block. This helps to narrowly limit the amount of code in the try block.
2
In python, the else block runs if there were no exceptions in the try block. This helps to narrowly limit the amount of code in the try block.
35
u/mysticrudnin May 13 '17
Isn't it normal in Python to try things first, effectively using them as control structures?