[Python-Dev] syntactic shortcut - unpack to variably sized list

"Martin v. Löwis" martin at v.loewis.de
Sat Nov 13 14:03:15 CET 2004


Nick Coghlan wrote:
> x = L[i:i+n]; del L[i:i+n]; return x
> 
> By default, n = 1, so the standard behaviour of list.pop is preserved.

This default would actually change the standard behaviour: whereas it
now returns a single element, it would then return a list containing
the single element.

Regards,
Martin


More information about the Python-Dev mailing list