[Python-ideas] iterable.__unpack__ method

Devin Jeanpierre jeanpierreda at gmail.com
Mon Feb 25 17:20:30 CET 2013


On Mon, Feb 25, 2013 at 7:45 AM, Jan Kaliszewski <zuo at chopin.edu.pl> wrote:
> But maybe it could be extended to include the following variant:
>
>     a, b, *() = iterable
>
> -- expressing the "leave the rest untouched" behaviour? Doesn't such
> an empty-tuple-literal-like syntax suggest strongly enough that
> no items are consumed?

I would've interpreted it as unpacking the rest of the iterable into
() -- i.e., I'd assume it has the current behavior of failing if the
rest of the iterable has anything at all.

Of course, you can't unpack anything into (), because Python never had
that syntax, but you get the idea.

-- Devin



More information about the Python-ideas mailing list