In article <[email protected]>, Chris Rebert <[email protected]> wrote:
> But at any rate: > shortfall = 4 - len(your_tuple) > your_tuple += (None,) * shortfall # assuming None is a suitable default > a, b, c, d = your_tuple > > If you also need to handle the "too many items" case, use slicing: > a, b, c, d = your_tuple[:4] I usually handle both of those cases at the same time: >>> a, b, c, d = (my_tuple + (None,) * 4)[:4] -- http://mail.python.org/mailman/listinfo/python-list
