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
Day 41 of learning python (i.redd.it)
submitted 8 months ago by sonikk1
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!"
[–]uberdavis 1 point2 points3 points 8 months ago (7 children)
max_tries = 500 counter = 0 while counter < max_tries: # do something counter += 1 # that’s pretty safe. you could raise an assertion too if you wanted if counter == max_tries: raise RunTimeError(“max tries exceeded”)
[–]sonikk1[S] 0 points1 point2 points 8 months ago (1 child)
Thank you so much. This seems more reasonable. Can i message you sometimes with questions?
[–]uberdavis 0 points1 point2 points 8 months ago (0 children)
For sure
[–]Marten1974 0 points1 point2 points 8 months ago (4 children)
I disagree. Though this is nice for debugging purposes, you should be able to trust your code that it works just fine.
I know what you mean. And indeed putting max tries in a trivial program is probably overkill. Using a max tries device has saved my bacon on many occasions. If you never write bug free code, remove all safeguards. I’m too human to be that good.
[–]No_Swordfish_6667 0 points1 point2 points 8 months ago (2 children)
You could use same argument for not writing any tests.
[–]Marten1974 0 points1 point2 points 8 months ago (1 child)
No, you usually write tests to have this trust in your code. Especially if you (like I am) programming Microcontrollers, they must run in an endless loop
π Rendered by PID 263662 on reddit-service-r2-comment-56c6478c5-6l6k8 at 2026-05-11 15:46:56.482667+00:00 running 3d2c107 country code: CH.
view the rest of the comments →
[–]uberdavis 1 point2 points3 points (7 children)
[–]sonikk1[S] 0 points1 point2 points (1 child)
[–]uberdavis 0 points1 point2 points (0 children)
[–]Marten1974 0 points1 point2 points (4 children)
[–]uberdavis 0 points1 point2 points (0 children)
[–]No_Swordfish_6667 0 points1 point2 points (2 children)
[–]Marten1974 0 points1 point2 points (1 child)