Don't use a list (that we modify) as a default argument

This commit is contained in:
louiz’ 2016-07-06 10:08:23 +02:00
parent 96a9fb699f
commit 3dcb04992d

View file

@ -68,7 +68,7 @@ class CommandArgParser(object):
return wrap return wrap
@staticmethod @staticmethod
def quoted(mandatory, optional=0, defaults=[], def quoted(mandatory, optional=0, defaults=None,
ignore_trailing_arguments=False): ignore_trailing_arguments=False):
"""The function receives a list with a number of arguments that is between """The function receives a list with a number of arguments that is between
@ -113,6 +113,8 @@ class CommandArgParser(object):
['un et demi', 'deux', 'trois quatre cinq six'] ['un et demi', 'deux', 'trois quatre cinq six']
""" """
if defaults is None:
defaults = []
def first(func): def first(func):
def second(self, args, *a, **kw): def second(self, args, *a, **kw):
default_args = defaults default_args = defaults