Jabin Jezreel 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)
that way is fine. Although usually it don't use parens and 0 is omitted...
a, b = l[:2], l[2:]
In python, direct index access is generally avoided whenever it is still
possible to use for or other constructs (but practical beats purity,
choose whatever method that produce a code that looks good and performs
good enough)
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor