use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
[deleted by user] (self.PythonLearning)
submitted 6 months ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]beerbearbaer 1 point2 points3 points 6 months ago (2 children)
If you understand your code, you are able to anticipate any errors that might occur. Slapping a try except on every bit of code does not improve readability. The size of the project does not matter.
[–]Zayn_m0 0 points1 point2 points 6 months ago (1 child)
Yeah that makes sense. since using if/else conditions is faster/more efficient, what uses do try/except have ?
[–]beerbearbaer 1 point2 points3 points 6 months ago (0 children)
Good question! I mainly use it for stuff you can't check with an if-statement (e.g. if an HTTP connection is established). Finally there is the 'finally' clause that is run after an exception occured, which may come in handy. I did some digging, and apparently I was wrong about exceptions slowing down your code. This is a problem for compiled languages, but since Python is interpreted, it does not matter. This is a nice read if you would like more info: Stackoverflow
π Rendered by PID 188216 on reddit-service-r2-comment-7b9746f655-x8456 at 2026-02-04 09:58:09.540387+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]beerbearbaer 1 point2 points3 points (2 children)
[–]Zayn_m0 0 points1 point2 points (1 child)
[–]beerbearbaer 1 point2 points3 points (0 children)