another generator idea

Perhaps more Pythonic?