Quantcast
Channel: User bavaza - Stack Overflow
Viewing all articles
Browse latest Browse all 45

Comment by bavaza on Wrong result when comparing ref and WeakMethod in Python?

$
0
0
Thanks @chepner. To me it seems a quirk in WeakMethod: even though id(x) != id(y), both x == y and WeakMethod(x) == WeakMethod(y) are true, which makes sense. However, altough cb != cb.methodm we still get ref(cb) == WeakMethod(cb.method). Since sets use __eq__ to compare objects, my 2nd call does not add the callable to the set. Obviously, I'll change my code to account for this.

Viewing all articles
Browse latest Browse all 45

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>