4 ms·
Not having heard of the `id` function in Python before, it still sounds like you can make mistakes with this; what if you saved the result of the `id` call of t
by saghm 8y ago
Not having heard of the `id` function in Python before, it still sounds like you can make mistakes with this; what if you saved the result of the `id` call of the first value into a variable and then compared it to the result of calling `id` on other values?
- recursive 8y agoI'm sure this could happen somehow, but it's difficult to think of a concrete example of where it would matter.
- fulafel 8y agoMake wrong lifetime assumptions and you get data corruption. I can imagine someone using it eg as an identifier in a web form, and passing it back to the app to lookup in some keyed data structure where they have used id as the keyfn - and getting back the incorrect object because the id has been recycled. Then it's saved to the db and you get data corruption.