Q:

Does Python select a 'default' tuple item/index?

Imagine the following function:
def getMinAndMax(numbers):

  return min(numbers), max(numbers)

What will happen if I do this? 
num = getMinAndMax([1,2,3,4,5])

Will num assume the value of the first item in the tuple, min, or will something else happen?  I know I can just try it, but I'm looking for some defined Python behavior here.

A:

Your function returns the two-element tuple min([1, 2, 3, 4, 5]), max([1, 2, 3, 4, 5]) which evaluates to 1, 5. So the statement
num = getMinAndMax([1,2,3,4,5])

will bind the name num to the tuple (1, 2) and you can access the individual values as num[0] and num[1]. Python does allow you, though, to use what's usually referred to as a unpacking assignment which looks like this:
nmin, nmax = getMinAndMax([1, 2, 3, 4, 5])

That binds each name to a succeeding element of the tuple on the right-hand side and allows you to use the values without indexing. If you need a tuple of the results your formulation is simplest, though of course the expression (nmin, nmax) will re-create it from the second one.

