1
0
mirror of https://github.com/satwikkansal/wtfpython synced 2024-12-22 12:50:23 +01:00

Merge pull request #290 from mattkohl-flex/master

Update README.md
This commit is contained in:
Satwik Kansal 2022-06-01 09:07:06 +05:30 committed by GitHub
commit e9a49a5527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

2
README.md vendored
View File

@ -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 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.
* 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
class WTF(object):
def __init__(self): print("I")