6 ms·
Interesting, had not considered that at all. So basically, to ensure the old reference is not released, just naming it would do the trick? AKA: >>> some_un
by avyfain 10y ago
Interesting, had not considered that at all.
So basically, to ensure the old reference is not released, just naming it would do the trick? AKA:
>>> some_unbound_method = A.b
>>> hex(id(some_unbound_method))
'0x104e2c0a0'
- phasmantistes 10y agoYep, that's right. To lay out the example the way you did in the article, it would look like: >>> foo = A.b >>> bar = A.b >>> hex(id(foo)) '0xdeadbeef' >>> hex(id(bar)) '0xdecafcab' >>> foo is bar False