Here's a little issue I run into more than I like: I often need to
unpack a sequence that may be too short or too long into a fixed-size
set of items:

a, b, c = seq      # when seq = (1, 2, 3, 4, ...) or seq = (1, 2)

What I usually do is something like this:

     a, b, c = (list(seq) + [None, None, None])[:3]

but that just feels rather ugly to me -- is there a good Pythonic
idiom for this?

Thx,
Rick
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to