When you ask list1 and list2, python calls the __bool__ on list1 and list2. Since [] evaluates to False, and a non-empty list evaluates to True, and looks at list1 and list2 in turn until it finds an empty list (or it looks at all the lists, if an empty list is never found).
Finally, the and expression evaluates to either that empty list that makes the and fail, or the last list in the comparison. This is why you get list2 back as the value.
Interestingly, you can use this behavior to your advantage to set default values:
def func(arg=None): arg = arg or [5] # now, [5] is the default value of arg
This is practically the same as doing:
def func(arg=None): if arg is None: arg = [5]