title: How to remove an element from a list, referencing it by weakref?
body: <p>How to remove a list's element by referencing it by weakref?</p>
  <pre><code>import weakref
  
  class Object():
      def __init__(self):
          pass
  
  object = Object()
  list = [object]
  print(list)
  
  wr = weakref.ref(object)
  list.remove(wr)
  print(list)
  </code></pre>
  <p>This returns a <code>ValueError: list.remove(x): x not in list</code>.</p>