JATothrim_v2

joined 1 month ago

~~demons~~ ahem. data-races.

[โ€“] JATothrim_v2@programming.dev 4 points 1 week ago (1 children)

For immutable types it is the same though.

The most twisted thing I learned is that all ints below a fixed limit share the same id() result, so

>>> x = 1
>>> id(x)
135993914337648
>>> y = 1
>>> id(y)
135993914337648

But then suddenly:

>>> x = 1000000
>>> id(x)
135993893250992
>>> y = 1000000
>>> id(y)
135993893251056

Using id() as a key in dict() may get you into trouble.