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

Fixed input-output of 4th example explanation code (#92)

Ref. example: Deep down, we're all the same
This commit is contained in:
Vibhu Agarwal 2018-08-28 14:24:54 +05:30 committed by Satwik Kansal
parent 2fb04501f7
commit ac379c9c03

16
README.md vendored
View File

@ -296,16 +296,24 @@ True
* But why did the `is` operator evaluated to `False`? Let's see with this snippet.
```py
class WTF(object):
def __init__(self): print("I ")
def __del__(self): print("D ")
def __init__(self): print("I")
def __del__(self): print("D")
```
**Output:**
```py
>>> WTF() is WTF()
I I D D
I
I
D
D
False
>>> id(WTF()) == id(WTF())
I D I D
I
D
I
D
True
```
As you may observe, the order in which the objects are destroyed is what made all the difference here.