标签:weak-references

  • Weakref和__slots__ - python

    时间:2020-8-25

    考虑以下代码: from weakref import ref class Klass(object): # __slots__ = ['foo'] def __init__(self): self.foo = 'bar' k = Klass() r = ref(k) 它可以工作,但是当我取消注释__slots__时, […]