You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some places we are using {} as default function param values. However this is error-prone as these default values are mutable and can be modified unexpectedly during the call:
In [1]: def fun(d={}):
...: d['count'] = d.get('count', 0) + 1
...: print(d)
...:
In [2]: fun()
{'count': 1}
In [3]: fun()
{'count': 2} # default value was modified
Right now it doesn't break anything, but it's worth to fix these cases, not using mutable objects as default values
The text was updated successfully, but these errors were encountered:
In some places we are using
{}
as default function param values. However this is error-prone as these default values are mutable and can be modified unexpectedly during the call:Right now it doesn't break anything, but it's worth to fix these cases, not using mutable objects as default values
The text was updated successfully, but these errors were encountered: