Fixed Output and reverted 4th example code

Ref. example: Deep down, we're all the same
This commit is contained in:
Vibhu Agarwal 2018-08-25 14:19:22 +05:30 committed by GitHub
parent 101684de28
commit 9e624542cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 4 deletions

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", end = " ")
def __del__(self): print("D", end = " ")
def __init__(self): print("I")
def __del__(self): print("D")
```
**Output:**
```py
>>> WTF() is WTF()
I I D D False
I
I
D
D
False
>>> id(WTF()) == id(WTF())
I D I D True
I
D
I
D
True
```
As you may observe, the order in which the objects are destroyed is what made all the difference here.