On Thu, Feb 4, 2021 at 9:31 AM Daniel Latypov wrote:
>
> This is a bug that has been present since the first version of this
> code.
> Using [] as a default parameter is dangerous, since it's mutable.
>
> Example using the REPL:
> >>> def bad(param = []):
> ... param.append(len(param))
> ...
This is a bug that has been present since the first version of this
code.
Using [] as a default parameter is dangerous, since it's mutable.
Example using the REPL:
>>> def bad(param = []):
... param.append(len(param))
... print(param)
...
>>> bad()
[0]
>>> bad()
[0, 1]
This wasn't a conce
2 matches
Mail list logo