sanest icon indicating copy to clipboard operation
sanest copied to clipboard

weakref support

Open wbolster opened this issue 7 years ago • 0 comments

it is not possible to create a (direct) weak reference to a sanest.dict or sanest.list. this is just like their built-in dict and list counterparts.

for the built-in types, this can be "fixed" using a subclass, as outlined in the weakref docs:

Several built-in types such as list and dict do not directly support weak references but can add support through subclassing:

  class Dict(dict):
      pass
  obj = Dict(red=1, green=2, blue=3)   # this object is weak referenceable

since sanest.dict and sanest.list prevent subclassing, this trick won't work for us.

it is unclear to me whether this is a problem at all. feel free to chime in if you have valid use cases.

wbolster avatar Jul 02 '17 18:07 wbolster