Make sure that default_arg is not passed rather than checking for falsity

```
if not default_arg:
    ...
```
fails when `default_arg` can be assigned and still be false (implementing a `__bool__` or `__len__` etc). You dont want to overwrite the passed values.
This commit is contained in:
Rahul Gopinath
2019-12-25 10:10:53 +01:00
committed by GitHub
parent 99280f57a0
commit 2f2fcf87bc

2
README.md vendored
View File

@@ -2173,7 +2173,7 @@ def some_func(default_arg=[]):
```py
def some_func(default_arg=None):
if not default_arg:
if default_arg is not None:
default_arg = []
default_arg.append("some_string")
return default_arg