You can always have a try/exept clause around unpacking. That you could fator out into a function that always returns the right sized tuples. Like this: def unpack(t): try: a,b,c = t d = None except ValueError: a,b,c,d = t return a,b,c,d -- Regards, Diez B. Roggisch