[Python-ideas] How assignment should work with generators?

Steven D'Aprano steve at pearwood.info
Tue Nov 28 01:15:23 EST 2017


On Mon, Nov 27, 2017 at 06:31:28PM -0800, Mike Miller wrote:

> Believe the question behind the idea was, how to grab a couple items and 
> then *stop?*  If the syntax route is chosen, I'd expect something that 
> tells me it is going to stop, like a "full stop" as the period/dot is 
> called in jolly ol' England, e.g.:
> 
>     x, y, . = iterable

Sadly, that fails the "syntax should not look like grit on Tim's 
monitor" test. Ellipsis at least has three pieces of grit in sequence, 
which makes it more noticable.


> Not sure about the second comma though.

Without the comma, it will be visually too hard to distinguish from 

    x, y , = iterable


-- 
Steve


More information about the Python-ideas mailing list