all 10 comments

[–]package 3 insightful - 2 fun3 insightful - 1 fun4 insightful - 2 fun -  (0 children)

With what specifically? Multithreading in python is pretty straightforward. Most of the complexity of multithreading is less about the choice of language and more about how to effectively break down a task into independent units.

[–]noice 3 insightful - 2 fun3 insightful - 1 fun4 insightful - 2 fun -  (0 children)

Multithreading is modern scum

[–][deleted] 2 insightful - 2 fun2 insightful - 1 fun3 insightful - 2 fun -  (2 children)

Python multi threading is a lie: https://realpython.com/python-gil/ You need multi-processing instead. (maybe it is a good fit for I/O bound tasks, maybe like web requests)

[–]fschmidt[S] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 1 fun -  (1 child)

I see, so Python threads are really coroutines, right? That still works okay in this case.

[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 1 fun -  (0 children)

yep, that sounds right

[–]SoCo 2 insightful - 2 fun2 insightful - 1 fun3 insightful - 2 fun -  (2 children)

Maybe I'm too used to the older python multitasking patterns, but I cringe when I see "await" used. They scream poor design to me, in most uses.

[–]fschmidt[S] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 1 fun -  (1 child)

What do you use instead of "await"?

[–]SoCo 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 1 fun -  (0 children)

Most of my bigger Python projects started before these features were added, so I'd just make my own event loop using 'multiprocessing' or 'threading' modules and design my own asynchronous handling around that. Now that I've tasted platforms with signals and slots, along with how nice that works with asynchronous queuing and event loops, the await/promise patterns seems kind of a clunky way of doing things.

[–]trident765 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 1 fun -  (1 child)

I briefly learned the await crap to debug this one vendor's library that used it. But once I was done debugging this I unlearned it because I didn't see a point to doing concurrent things this way. In practice I find that most concurrent things can be done with the python threading module:

https://realpython.com/intro-to-python-threading/

For GUI stuff I use QThreads.

[–]fschmidt[S] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 1 fun -  (0 children)