print
is (correctly) printing the tuple that is returned from d. To print the values individually, try this:
print '{} {}'.format(*d())
Or this:
dret = d()
print dret[0],dret[1]
print a,b
doesn't interpret a,b
as a tuple, but rather as a sequence of parameters to the print
statement. Note that the print
statement changes syntax in Python3 for added confusion.
To make the a,b
case parallel to the q,r
case, it would look more like this:
c = a,b
print c
In that case the print
statement would receive a tuple, and not two individual values.