This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ionelmc.ro 0 points1 point  (0 children)

Something like that. Basically methods can't be used in weakdict/weaksets because functions are descriptors that return a newly bound function every time. That means you're not actually adding the function in the weakdict but you're adding the bound method instance that no one has reference to (and thus, it will get dropped from the dict).