[Python-ideas] How assignment should work with generators?
Greg Ewing
greg.ewing at canterbury.ac.nz
Mon Nov 27 17:40:49 EST 2017
Guido van Rossum wrote:
> Is this problem really important enough that it requires dedicated
> syntax? Isn't the itertools-based solution good enough?
Well, it works, but it feels very clumsy. It's annoying to
have to specify the number of items in two places.
Also, it seems perverse to have to tell Python to do *more*
stuff to mitigate the effects of stuff it does that you
didn't want it to do in the first place.
Like I said, I'm actually surprised that this doesn't already
work. To me it feels more like filling in a piece of
functionality that was overlooked, rather than adding a
new feature. Filling in a pothole in the road rather than
bulding a new piece of road.
(Pushing the road analogy maybe a bit too far, the current
itertools solution is like digging *more* potholes to make
the road bumpy enough that you don't notice the first
pothole.)
> (Or failing
> that, couldn't we add something to itertools to make it more readable
> rather than going straight to new syntax?)
I'm not sure how we would do that. Even if we could, it
would still feel clumsy having to use anything from itertools
at all.
--
Greg
More information about the Python-ideas
mailing list