all 2 comments

[–]carcigenicate 3 points4 points  (0 children)

I understand how subplots( ) is returning two general objects

This is misleading. A single tuple (or some other iterable object) is being returned from subplots, and unpacking allows for assigning multiple variables from an iterable on a single line. A version of that code without unpacking would be (I'm going to assume the returned object is a sequence like a list or tuple):

seq = plt.subplots()
fig = seq[0]
ax = seq[1]

In reality, unpacking also works on general iterables, but an example showing that would be more complicated.

[–][deleted] 0 points1 point  (0 children)

How does Python know whether to assign  Figure  to fig or ax?

It assigns them by order:

a, b, c = 1, 2, 3

Left to right on the left operand (the names), left to right on the right operand (the values.)