1
0
mirror of https://github.com/satwikkansal/wtfpython synced 2024-11-24 12:04:24 +01:00

Fixed input-output of 4th example explanation code

Deep down we're all the same: Input-Output formatting of the explanation code
https://github.com/satwikkansal/wtfpython#-deep-down-were-all-the-same-
This commit is contained in:
Vibhu Agarwal 2018-08-13 11:12:51 +05:30 committed by GitHub
parent 2fb04501f7
commit 101684de28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

8
README.md vendored
View File

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