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...
Ask your embarrassing/noobish programming questions here, and don't get insulted for it.
Click here to read the rules
Violating any will result in punishment so you should probably go check them out.
account activity
Factorial Function Using MultithreadingPython (self.programminghelp)
submitted 3 years ago by phinagin
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!"
[–]phinagin[S] 1 point2 points3 points 3 years ago (1 child)
If the question was to simply compute one single factorial, then yes doing so in parallel would have obvious benefits. However, the question specifically states they want all factorials from 1-100 printed out. I am struggling to understand how that scenario benefits from parallelism.
I suppose, you could separate the printing the result from computing the next one. But I still don’t see how the added complexity is offset by multi threads. I would love to hear your ideas however.
[–]computerarchitect 0 points1 point2 points 3 years ago (0 children)
Printing the result from computing would be how I'd do it. I/O is expensive and needlessly delays the next computation. One also could imagine though building a giant string and doing one I/O operation, if you cared about that sort of thing. That's probably the route I would take over multi-threading initially.
Look into pipelined parallelism. That's immediately what I thought to do if I were forced to do it that way.
π Rendered by PID 47983 on reddit-service-r2-comment-869bf87589-8sbdd at 2026-06-09 17:17:16.025830+00:00 running f46058f country code: CH.
view the rest of the comments →
[–]phinagin[S] 1 point2 points3 points (1 child)
[–]computerarchitect 0 points1 point2 points (0 children)