diff options
| author | SaJH <wogur981208@gmail.com> | 2024-09-09 23:41:56 +0900 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-12-02 11:17:51 +0100 |
| commit | b0d9c1fe32c74b49bfebf0691530944251cad523 (patch) | |
| tree | 15f09c66cc59fbc09743e1a7a12506463de82956 /docs/ref | |
| parent | b8f9f625a19298379dbc16d916694702cd038f52 (diff) | |
Updated docs example to clear cached_property without raising AttributeError.
Signed-off-by: SaJH <wogur981208@gmail.com>
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/utils.txt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt index 33e0fceadf..438a38cea0 100644 --- a/docs/ref/utils.txt +++ b/docs/ref/utils.txt @@ -521,7 +521,7 @@ https://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004 The cached value can be treated like an ordinary attribute of the instance:: # clear it, requiring re-computation next time it's called - del person.friends # or delattr(person, "friends") + person.__dict__.pop("friends", None) # set a value manually, that will persist on the instance until cleared person.friends = ["Huckleberry Finn", "Tom Sawyer"] |
