diff options
Diffstat (limited to 'pydis_site/apps/content/resources')
-rw-r--r-- | pydis_site/apps/content/resources/guides/python-guides/mutability.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pydis_site/apps/content/resources/guides/python-guides/mutability.md b/pydis_site/apps/content/resources/guides/python-guides/mutability.md index 185dc87c..e180fd16 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/mutability.md +++ b/pydis_site/apps/content/resources/guides/python-guides/mutability.md @@ -30,11 +30,11 @@ It just returns a new one. Let's examine what's going on here. At first, the variable `s` refers to some object, the string `'hello'`. - +{: class="has-dark-mode-background" } When you call `s.upper()`, a new string, which contains the characters `'HELLO'`, gets created. - +{: class="has-dark-mode-background" } This happens even if you just call `s.upper()` without any assignment, on its own line: ```python @@ -44,12 +44,12 @@ In this case, a new object will be created and discarded right away. Then the assignment part comes in: the name `s` gets disconnected from `'hello'`, and gets connected to `'HELLO'`. - +{: class="has-dark-mode-background" } Now we can say that `'HELLO'` is stored in the `s` variable. Then, because no variables refer to the _object_ `'hello'`, it gets eaten by the garbage collector. - +{: class="has-dark-mode-background" } It means that the memory reserved for that object will be freed. If that didn't happen, the 'garbage' would accumulate over time and fill up all the RAM. |