Return a namedtuple
instead of a regular tuple, and you don't need to unpack it. You can then later extend the returned tuple without affecting existing users of the API:
from collections import namedtuple
QuuxReturnValue = namedtuple('QuuxReturnValue', ('foo', 'bar'))
def quux(*args, **kw):
while True:
yield QuuxReturnValue(foo='foo', bar='bar')
and your API is consumed like:
for retval in quux():
print retval.foo, retval.bar
If you later update the namedtuple
to add a 3rd parameter 'baz'
the above consumer is still going to work.