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

electronnn at gmail.com electronnn at gmail.com
Tue Nov 28 01:24:16 EST 2017


How about x, y ?= iterable with ?= being the lazy assignment operator?

On Tue, Nov 28, 2017 at 9:45 AM, Steven D'Aprano <steve at pearwood.info>
wrote:

> 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
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20171128/b18758bd/attachment.html>


More information about the Python-ideas mailing list