473,398 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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
Feb 25 '07 #1
2 2743
En Sun, 25 Feb 2007 19:07:38 -0300, John Nagle <na***@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

Feb 26 '07 #2
Gabriel Genellina wrote:
En Sun, 25 Feb 2007 19:07:38 -0300, John Nagle <na***@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
Feb 26 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ames Andreas (MPA/DF) | last post by:
Hi all, I'm using python 2.1 and can't easily upgrade (Zope). I'm using the Queue module to synchronize/communicate between two threads and weakref.proxy objects to avoid cycles. Scenario: ...
1
by: Mathias Mamsch | last post by:
Hi, I have some confusion concerning the weakref module. I am trying to save a weak reference to a bound member function of a class instance for using it as a callback function. But I always...
2
by: Mike C. Fletcher | last post by:
I'm looking at rewriting parts of Twisted and TwistedSNMP to eliminate __del__ methods (and the memory leaks they create). Looking at the docs for 2.3's weakref.ref, there's no mention of whether...
5
by: Bill Hauver | last post by:
I am attempting to use a web service from my work pc which is behind a firewall. I have used wsdl.exe to create the web service reference class and added it to my project. (this seems to work...
8
by: andyjgw | last post by:
Hi all, hope someone can help here, I'm really stuck. Reading and googling like mad, to no avail so far... Basically, my problem *seems* to boil down to type conversion: Here's a sample web...
1
by: Dave Mathew | last post by:
I'm attempting to write a reverse proxy in ASP.Net which will catch requests to my server in ASP.Net, perform some actions, and then get the desired resource off another server to return to the...
3
by: Odalrick | last post by:
I'm trying to write a simple game and decided I need an eventmanager. <code> import weakref from collections import defaultdict class _EventManager( object ): def __init__( self ):...
6
by: George Sakkis | last post by:
I'm baffled with a situation that involves: 1) an instance of some class that defines __del__, 2) a thread which is created, started and referenced by that instance, and 3) a weakref proxy to the...
1
by: Ripter | last post by:
I found this script at http://www.pygame.org/wiki/LazyImageLoading?parent=CookBook And I can't quite figure out how it works. I was wondering if someone could clarify it for me. The Code is: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.