[Tutor] (a, b) = (l[0:2], l[2:])

Alan Gauld alan.gauld at btinternet.com
Wed May 13 16:25:33 CEST 2009


"Jabin Jezreel" <jabinjezreel at gmail.com> wrote 

> What is the idiomatic way to write the right side of
>    (a, b) = (l[0:2], l[2:])
> ?
> (not worried about the parens, just the splitting of the sequence)

I think you have it.
I'm not aware of any better way.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list