[David Mertz]
Oops... yeah.  I had fixed the "up to and including" previously, but somehow I copied the wrong version to the thread.

Doesn't matter ;-)  The point here, to me, is that the prime generator I pointed at is significantly faster, more memory-frugal, and even "more correct", than even experienced Python programmers are likely to come up with at first.

That gives it real value as a candidate for a standard library.  But something much fancier than that?  I don't think so, for reasons already given - the code is still understandable for non-experts if they give it some effort.  Fancier stuff may not be.

For example, in my own code I use a fancier version of that incorporating a wheel sieve too, and even the _setup_ function for that is harder to understand all on its own:

def _setup_sieve(ps, show=True):
from math import gcd

assert ps == 2
prod = totient = 1
for p in ps:
assert pp(p)
prod *= p
totient *= p-1
if show:
print("ps", ps, "prod", prod)
mod2i = [None] * prod
mod2i = 0
deltas = []
last = 1
for i in range(3, prod, 2):
if gcd(prod, i) == 1:
deltas.append(i - last)
mod2i[i] = len(deltas)
last = i
deltas.append(2)    # wrap around from prod-1 to 1
assert len(deltas) == totient
assert sum(deltas) == prod
if show:
print("deltas", deltas, len(deltas))
print("mod2i", mod2i)
return ps, deltas * 2, mod2i

_siv_glob = _setup_sieve([2, 3, 5, 7], show=False)

I don't want that in the standard library - and twice as much don't want it if somebody else wrote  it ;-)