mirror of
https://github.com/satwikkansal/wtfpython
synced 2024-11-25 04:24:23 +01:00
Merge pull request #178 from larsks/fix/bad-logic
Fixed logic error in "Beware of default mutable arguments!"
This commit is contained in:
commit
8e6c850f30
2
README.md
vendored
2
README.md
vendored
@ -2241,7 +2241,7 @@ def some_func(default_arg=[]):
|
|||||||
|
|
||||||
```py
|
```py
|
||||||
def some_func(default_arg=None):
|
def some_func(default_arg=None):
|
||||||
if default_arg is not None:
|
if default_arg is None:
|
||||||
default_arg = []
|
default_arg = []
|
||||||
default_arg.append("some_string")
|
default_arg.append("some_string")
|
||||||
return default_arg
|
return default_arg
|
||||||
|
Loading…
Reference in New Issue
Block a user