News for hackers. Stuff that matters.
Re:Python: Uncovering the Overlooked Core Functionalities by slt2021 on Monday July 24, 2023 @05:40PM (#36854595)
so Thread based based pool will have same instance of generator, while Process based pool with have unique instance of generator?
Re:Python: Uncovering the Overlooked Core Functionalities by TrianguloY on Monday July 24, 2023 @05:54PM (#36854775)
I don't know if a generator can be shared across threads, but in that case ... I have no idea :/

You'll need to search, or try!

Re:Python: Uncovering the Overlooked Core Functionalities by kzrdude on Tuesday July 25, 2023 @07:29AM (#36860754)
In this example, calling sum() creates a generator and returns it. Say g = sum(). If you share g between threads, they will all use the same generator object! If you call sum() separately per thread, they will be different generators.

If you try to send g to a different process, you will get an error, because it doesn't serialize.