You cannot force it to yield only to one element of the tuple without changing f . However, you can easily generate generators, for example, using a generator expression:
just_a_please = (a for a,b in f())
To consume all a with one hit, you should prefer a list comprehension:
all_a = [a for a,b in f()]
If you need only one of them, there is next :
give_me_an_a, _b = next(f())
source share