[Python-ideas] Unpack of sequences

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Sep 1 02:03:06 CEST 2012


Steven D'Aprano wrote:

> For sequences:
> 
> a, b, c, d = really_long_sequence[:4]

Sure, there are any number of ways of doing it, but they
all involve some degree of convolution or DRY-violation.

The most direct and obvious way is denied to us, because there
is no way to tell the unpacking operation *not* to check for
the end of the sequence afterwards. Because that unwanted
check is forced on us, we have to perform even more useless
work to get around it. That seems perverse to me.

-- 
Greg




More information about the Python-ideas mailing list