String question

Terry Reedy tjreedy at udel.edu
Tue Jun 24 14:40:34 EDT 2008


cokofreedom at gmail.com wrote:
> On Jun 24, 5:38 am, "Mark Tolonen" <M8R-yft... at mailinator.com> wrote:


> In Python 3k I believe you can put a * next to one of the variables to
> hold multiple arguments. That'll be aidful!

IDLE 3.0b1
 >>> a,b,*c=[1,2,3,4,5]
 >>> c
[3, 4, 5]
 >>> a,*b,c = [1,2,3,4,5]
 >>> b
[2, 3, 4]
 >>> a,b,*c=[1,2]
 >>> c
[]

Augmented assignment is quite similar to argument passing:
at most one starred target;
at least as many items as un-starred targets (as now).

tjr




More information about the Python-list mailing list