From 69b66260465bb0a7e3a72778689b3ccd9cbf30ad Mon Sep 17 00:00:00 2001 From: mikejturner Date: Thu, 29 Feb 2024 14:24:29 +0800 Subject: [PATCH] Modifies sentence and provides link to explanation of mutable defaults gotcha in the documentation (#1251) Adds link to explanation of mutable default gotcha --- docs/init.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/init.md b/docs/init.md index c43cede9..a4b8e483 100644 --- a/docs/init.md +++ b/docs/init.md @@ -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