[Python-ideas] Generator unpacking

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Feb 15 15:23:03 EST 2016


Sven R. Kunze wrote:
> So, if it's illegal to assign to the literal [1,2], I don't see why it 
> should be legal for []. But as you said, that's a highly theoretical 
> problem.

But [1,2] is not a literal -- the individual elements
1 and 2 are. It's the inability to assign to those
elements that makes it illegal.

On the other hand, [] doesn't contain any elements that
it's illegal to assign to, so there's no reason to
reject it.

But it doesn't contain any elements that it's legal to
assign to either, so you could say there's no reason
to accept it.

This is a philosophical question. When you've eaten
the last chocolate, do you have an empty box of
chocolates, or just an empty box?

-- 
Greg


More information about the Python-ideas mailing list