mirror of
https://github.com/satwikkansal/wtfpython
synced 2024-11-22 02:54:25 +01:00
Update README.md
Grammatical fix
This commit is contained in:
parent
fe9ed47217
commit
be377779b6
2
README.md
vendored
2
README.md
vendored
@ -619,7 +619,7 @@ True
|
|||||||
* When `id` was called, Python created a `WTF` class object and passed it to the `id` function. The `id` function takes its `id` (its memory location), and throws away the object. The object is destroyed.
|
* When `id` was called, Python created a `WTF` class object and passed it to the `id` function. The `id` function takes its `id` (its memory location), and throws away the object. The object is destroyed.
|
||||||
* When we do this twice in succession, Python allocates the same memory location to this second object as well. Since (in CPython) `id` uses the memory location as the object id, the id of the two objects is the same.
|
* When we do this twice in succession, Python allocates the same memory location to this second object as well. Since (in CPython) `id` uses the memory location as the object id, the id of the two objects is the same.
|
||||||
* So, the object's id is unique only for the lifetime of the object. After the object is destroyed, or before it is created, something else can have the same id.
|
* So, the object's id is unique only for the lifetime of the object. After the object is destroyed, or before it is created, something else can have the same id.
|
||||||
* But why did the `is` operator evaluated to `False`? Let's see with this snippet.
|
* But why did the `is` operator evaluate to `False`? Let's see with this snippet.
|
||||||
```py
|
```py
|
||||||
class WTF(object):
|
class WTF(object):
|
||||||
def __init__(self): print("I")
|
def __init__(self): print("I")
|
||||||
|
Loading…
Reference in New Issue
Block a user