If you are looking for a maintainable way of getting default values on the index operator I found the following useful:
If you override operator.getitem
from the operator module to add an optional default parameter you get identical behaviour to the original while maintaining backwards compatibility.
def getitem(iterable, index, default=None):
import operator
try:
return operator.getitem(iterable, index)
except IndexError:
return default