mirror of
https://github.com/satwikkansal/wtfpython
synced 2025-07-04 20:38:06 +02:00
remove lineskip and bolden string interning in contents.md
This commit is contained in:
parent
28fa624a88
commit
c84b5169d8
2 changed files with 1 additions and 2 deletions
1
README.md
vendored
1
README.md
vendored
|
@ -195,7 +195,6 @@ False
|
|||
Makes sense, right?
|
||||
|
||||
#### 💡 Explanatios:
|
||||
|
||||
+ Such behavior is due to CPython optimization (called **string interning**) that tries to use existing immutable objects in some cases rather than creating a new object every time.
|
||||
+ Note that the keyword `is` is used for _reference_ equality (unlike `==` which is used for _value_ equality); this means that `a is b` is the same as `id(a) == id(b)`, and therefore it should not be used for string comparison. It is only used here to illustrate the effects of string interning.
|
||||
+ After being interned, many variables may point to the same string object in memory (thereby saving memory).
|
||||
|
|
2
wtfpython-pypi/content.md
vendored
2
wtfpython-pypi/content.md
vendored
|
@ -555,7 +555,7 @@ False
|
|||
Makes sense, right?
|
||||
|
||||
#### 💡 Explanation:
|
||||
+ Such behavior is due to CPython optimization (called string interning) that tries to use existing immutable objects in some cases rather than creating a new object every time.
|
||||
+ Such behavior is due to CPython optimization (called **string interning**) that tries to use existing immutable objects in some cases rather than creating a new object every time.
|
||||
+ Note that the keyword `is` is used for _reference_ equality (unlike `==` which is used for _value_ equality); this means that `a is b` is the same as `id(a) == id(b)`, and therefore it should not be used for string comparison. It is only used here to illustrate the effects of string interning.
|
||||
+ After being interned, many variables may point to the same string object in memory (thereby saving memory).
|
||||
+ In the snippets above, strings are implicitly interned. The decision of when to implicitly intern a string is implementation dependent. There are some facts that can be used to guess if a string will be interned or not:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue