Hi, some methods of the Dataset class use list() as a default value for its parameters. This practice may cause some unexpected behaviors in some contexts. This problem arises because of the way python variables (names) work. When modifying these parameters (e.g appending items to it) the method still uses the same default value:
def append_item(item, data=[]):
data.append(item)
return data
>> append_item(1)
[1]
>> append_item(2) # [2] is the expected value
[1, 2]
So that, the workaround is always using the None type as the default of the parameters
methods having mutable types as parameters defaults:
Hi, some methods of the
Dataset
class uselist()
as a default value for its parameters. This practice may cause some unexpected behaviors in some contexts. This problem arises because of the way python variables (names) work. When modifying these parameters (e.g appending items to it) the method still uses the same default value:So that, the workaround is always using the
None
type as the default of the parametersmethods having mutable types as parameters defaults:
Row.__init__(row=list(), tags=list())
Dataset.insert(index, row, tags=list())
Dataset.rpush(row, tags=list())
Dataset.lpush(row, tags=list())
Dataset.append(row, tags=list())
Dataset.extend(row, tags=list())
Note: This is my first issue