Skip to content

Commit

Permalink
Modifies sentence and provides link to explanation of mutable default…
Browse files Browse the repository at this point in the history
…s gotcha in the documentation (#1251)

Adds link to explanation of mutable default gotcha
  • Loading branch information
mikejturner committed Feb 29, 2024
1 parent 0a2b738 commit 69b6626
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ C(a=42, b=[], c=[], d={})

It's important that the decorated method -- or any other method or property! -- doesn't have the same name as the attribute, otherwise it would overwrite the attribute definition.

Please note that as with function and method signatures, `default=[]` will *not* do what you may think it might do:
Similar to the [common gotcha with mutable default arguments](https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments), `default=[]` will *not* do what you may think it might do:

```{doctest}
>>> @define
Expand Down

0 comments on commit 69b6626

Please sign in to comment.