[lxml-dev] Weakref support?

Christian Zagrodnick cz at gocept.com
Mon Jul 27 10:51:27 CEST 2009


On 2009-07-20 09:21:50 +0200, Stefan Behnel <stefan_ml at behnel.de> said:

> 
> Christian Zagrodnick wrote:
>> On 2009-07-19 15:25:52 +0200, Stefan Behnel said:
>>> Is there a specific use case you have in mind?
>> 
>> Actually all I'd need is a reference to the tree. I don't think
>> weak-refs to all elements are necessary or useful. Well, maybe they
>> are, but I don't need them :)
> 
> That sounds better. :)
> 
> Feel free to add a
> 
> 	cdef object __weakref__
> 
> to the _ElementTree class (below the _context_node attribute) and see if
> that works for you. Please report back if it turns out be useful.

Hm. Creating a weakref to the tree (getroottree()) works. But since the 
etree itself doesn't keep a reference to that object but creates new 
onces for each call it doesn't help.

I suppose there is no way of changeing that behaviour, is there?


-- 
Christian Zagrodnick · cz at gocept.com
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 4 · fax +49 345 1229889 1
Zope and Plone consulting and development




More information about the lxml-dev mailing list