This python code generates prime numbers using Sieve's technique. I am having trouble understanding the code in particular the yield from
parts. How to trace such a code or make it simpler to understand. This code is from the video from Computerphile Youtube channel about laziness in python.
def nats(n):
yield n
yield from nats(n+1)
def sieve(s):
n = next(s)
yield n
yield from sieve(i for i in s if i%n != 0)
p = sieve(nats(2))
next(p) # generates prime numbers 2, 3, 5, 7, 11, ........