Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2fb0450 commit ac379c9Copy full SHA for ac379c9
README.md
@@ -296,16 +296,24 @@ True
296
* But why did the `is` operator evaluated to `False`? Let's see with this snippet.
297
```py
298
class WTF(object):
299
- def __init__(self): print("I ")
300
- def __del__(self): print("D ")
+ def __init__(self): print("I")
+ def __del__(self): print("D")
301
```
302
303
**Output:**
304
305
>>> WTF() is WTF()
306
- I I D D
+ I
307
308
+ D
309
310
+ False
311
>>> id(WTF()) == id(WTF())
- I D I D
312
313
314
315
316
+ True
317
318
As you may observe, the order in which the objects are destroyed is what made all the difference here.
319
0 commit comments