Re:Show HN: Pydb – a lightweight database with Python syntax...
by moreati on Saturday January 28, 2017 @06:26PM
(#13510274)
It's not ideal. For instance if I as the caller wished to provide an empty dict-like object (e.g. dict_arg=collections.OrderedDict()), then your code would silently ignore it, and use a new dict.
Instead of checking for any object that evaluates to False, you should explicitly check for None, e.g.
def func(list_arg=None, dict_arg=None):
if list_arg is None:
list_arg = []
...
Instead of checking for any object that evaluates to False, you should explicitly check for None, e.g.