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.