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.
If you try to send g to a different process, you will get an error, because it doesn't serialize.