Avoid modifying default function arguments

Modifying passed arguments inadvertently is an easy pitfall in python.
Even more serious is modifying the default value to a function, since
that modification will be preserved across future function calls.

The typical defense against the latter is to avoid using mutable default
values.

This change replaces several def foo(bar=[]) with bar=() or similar, and
then fixes a few cases that were exposed where the argument was indeed
permanently modified.

Change-Id: I3d04dcb39e3816942f8e80ce499c47d774a773c6
Merge "Avoid modifying default function arguments"