aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Brody Critchlow <[email protected]>2023-01-25 15:54:23 -0700
committerGravatar GitHub <[email protected]>2023-01-25 15:54:23 -0700
commit27eb0f9eb1a3795ed6eeadb3d9b35e9de29831e9 (patch)
treeb4e94f869308a5f9c2eb9e85a72f0813385ce3d4
parentUpdate in-place.md (diff)
Update in-place.md
-rw-r--r--bot/resources/tags/in-place.md6
1 files changed, 3 insertions, 3 deletions
diff --git a/bot/resources/tags/in-place.md b/bot/resources/tags/in-place.md
index c81fa660a..9f6ec6402 100644
--- a/bot/resources/tags/in-place.md
+++ b/bot/resources/tags/in-place.md
@@ -5,7 +5,7 @@
A prime example of these different ideas is `list.sort()` vs `sorted(...)`:
-`list.sort()` can cause many errors within your code, one of the most common is shown below:
+This is a common use for `list.sort()` which will end in an error.
```py
a_list = [3, 1, 2]
@@ -13,7 +13,7 @@ a_new_list = a_list.sort() # This will be None
print(a_new_list[1]) # This will error
```
-On the other hand, `sorted()` can also cause errors:
+This is a common use for `sorted()` which will end in a unexpected result.
```py
a_list = [3, 1, 2]
@@ -21,4 +21,4 @@ sorted(a_list)
print(a_list[0]) # You may expect 1, but it will print 3
```
-Both of these errors are an easy fixes.
+To fix this you just need to set a new variable to `sorted(a_list)`, and don't create a new list for `list.sort()`