Pythonification of the asterisk-based collection packing/unpacking syntax

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Dec 25 08:13:36 EST 2011


On Sat, 24 Dec 2011 06:47:21 -0800, Eelco wrote:

> I would like to be able to write something like:
> 
> a, middle::tuple, b = ::sequence
> 
> Where I would like the extra :: before the sequence to explicitly signal
> collection unpacking on the rhs, to maintain the symmetry with
> collection unpacking within a function call.

The :: on the right-hand side is redundant, because the left-hand side 
already explicitly signals collection unpacking of the RHS. Requiring :: 
on the RHS above is as unnecessary as it would be here:

    n = len(::sequence)



-- 
Steven



More information about the Python-list mailing list