Python Memes - s50600822/Notes GitHub Wiki
Why is hash(-1) == hash(-2) in Python
python3 -c "import platform; print(platform.python_implementation())"
CPython
>>> a=256
>>> b=256
>>> a is b
True
>>> x=257
>>> y=257
>>> x is y
False
>>> l =[{}]*2
>>> l
[{}, {}]
>>> l[0]['a']='x'
>>> l[1]['b']='y'
>>> l
[{'a': 'x', 'b': 'y'}, {'a': 'x', 'b': 'y'}]