Commit 8fdf22e5 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Replace dangerous (mutable) default value.

parent c6015996
......@@ -70,7 +70,9 @@ class Command(object):
return value
def getopt(self, p_flags, p_long=[]):
def getopt(self, p_flags, p_long=None):
p_long = p_long or []
try:
result = getopt.getopt(self.args, p_flags, p_long)
except getopt.GetoptError as goe:
......
......@@ -58,7 +58,7 @@ def pp_color(p_todo_str, p_todo):
def pp_indent(p_indent=0):
return lambda s, t: ' ' * p_indent + s
def pretty_print(p_todo, p_filters=[]):
def pretty_print(p_todo, p_filters=None):
"""
Given a todo item, pretty print it and return a list of formatted strings.
......@@ -70,6 +70,7 @@ def pretty_print(p_todo, p_filters=[]):
Example is pp_color in this fle.
"""
p_filters = p_filters or []
todo_str = str(p_todo)
......@@ -78,9 +79,10 @@ def pretty_print(p_todo, p_filters=[]):
return todo_str
def pretty_print_list(p_todos, p_filters=[]):
def pretty_print_list(p_todos, p_filters=None):
"""
Given a list of todo items, pretty print it and return a list of
formatted strings.
"""
p_filters = p_filters or []
return [pretty_print(todo, p_filters) for todo in p_todos]
......@@ -42,8 +42,9 @@ class View(object):
for _filter in self._filters:
self._viewdata = _filter.filter(self._viewdata)
def pretty_print(self, p_pp_filters=[]):
def pretty_print(self, p_pp_filters=None):
""" Pretty prints the view. """
p_pp_filters = p_pp_filters or []
pp_filters = [self._todolist.pp_number(), pp_color] + p_pp_filters
return '\n'.join(pretty_print_list(self._viewdata, pp_filters))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment