Weakref problem: no way to get original object from proxy object?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Nagle

    Weakref problem: no way to get original object from proxy object?

    Is there some way to get a strong ref to the original object back
    from a weakref proxy object? I can't find any Python function to do this.
    ".ref()" doesn't work on proxy objects.

    John Nagle
  • Gabriel Genellina

    #2
    Re: Weakref problem: no way to get original object from proxy object?

    En Sun, 25 Feb 2007 19:07:38 -0300, John Nagle <nagle@animats. com>
    escribió:
    Is there some way to get a strong ref to the original object back
    from a weakref proxy object? I can't find any Python function to do
    this.
    ".ref()" doesn't work on proxy objects.
    Add a method to the original class that just returns self.

    About your backref function: Yes, I usually use something like that, it's
    annoying having to handle None always.

    --
    Gabriel Genellina

    Comment

    • John Nagle

      #3
      Re: Weakref problem: no way to get original object from proxy object?

      Gabriel Genellina wrote:
      En Sun, 25 Feb 2007 19:07:38 -0300, John Nagle <nagle@animats. com>
      escribió:
      >
      > Is there some way to get a strong ref to the original object back
      >from a weakref proxy object? I can't find any Python function to do
      >this.
      >".ref()" doesn't work on proxy objects.
      >
      >
      Add a method to the original class that just returns self.
      Yes, that works. Thanks.

      John Nagle

      Comment

      Working...