Modifies sentence and provides link to explanation of mutable defaults gotcha in the documentation (#1251)

Adds link to explanation of mutable default gotcha
This commit is contained in:
mikejturner 2024-02-29 14:24:29 +08:00 committed by GitHub
parent 0a2b73891f
commit 69b6626046
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -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