I feel that there should be a nice way to get the following (non-working) code to work:
a, b, c, d = generator()
where the generator is infinite, and the created objects are somehow interesting. It is simply intended to be a good way to say, to make all of these variables different (possibly) things from this generated template. Unfortunately, this is a syntax error. We could do this:
a, b, c, d, *_ = generator()
But, unfortunately, it is trying to do _in an endless list of what I do not want. I was hoping that it would simply capture the rest of the generator (for later use or just for ignoring).
I could also do something like this:
gen = generator()
a, b, c, d = (gen.__next__() for _ in range(0, 4))
but it requires me to specify 4, which I would rather not do. The designation isertools islice looks better:
a, b, c, d = itertools.islice(generator(), 4)
- , . , , !