Re:Python overtakes JavaScript as most questioned language o...
by goodside on Saturday April 20, 2019 @03:21PM
(#19708377)
That value will not change when the contents of the dict are updated. You’re keying on the dict itself rather than the hashed contents. That’s what you want in some situations, but it’s not what the parent post is looking for.
[ Parent
| on HN ]
Re:Python overtakes JavaScript as most questioned language o...
by Nullabillity on Saturday April 20, 2019 @05:49PM
(#19709072)
It's also not reliable, since the same address can be reused if the dict is GCed. This is actually really easy to induce in Python, since it uses immediate refcounting. In my REPL (3.7.3):
>>> a = {}
>>> x = id(a)
>>> del a
>>> a = {}
>>> y = id(a)
>>> x == y
True