[Pyrex] weak references to Pyrex instances?

Lenard Lindstrom len-l at telus.net
Sun Oct 10 20:29:39 CEST 2004


On Sun, 10 Oct 2004 03:33:32 +0400 "Michael P. Dubner" <pywebmail at list.ru> wrote:

> Lenard Lindstrom wrote:
> >On Tue, 05 Oct 2004 14:37:19 +1300 Greg Ewing <greg at cosc.canterbury.ac.nz> wrote:
> >
> >>Phillip J. Eby" <pje at telecommunity.com>:
> >>
> >>>ell, you can probably subclass it in Python and add:
> >>>
> >>>     __slots__ = '__weakref__'
> >>>
> >>>I don't know for sure if it works with Pyrex, nor do I know a better way to 
> >>>do it with Pyrex.
> >>>      
> >>>
> >>Adding weakref support is on my todo list, but I haven't got
> >>around to it yet.
> >>
> >>Also, I haven't decided whether all extension types should
> >>be weak referenceable automatically, or whether it should
> >>be an option. Any thoughts on that from people?
> >>
> >>    
> >>
> >Make weak referencing optional as it is with __slots__.
> >  
> >
> Surely. In that usage cases where it's doesn't matter overhead of typing
> isn't very hard, but when it's matters - it's matters.
> Also compatibility with Python code is Good Thing. (I.e. when
> preprocessing to Python/Pyrex code :-) )
> 
Yes. Extension types are not only for wrapping external C types. They are
also for optimization, as with __slots__. So features that increase memory
usage or degrade performance should be available on request instead of by default.

Lenard Lindstrom
<len-l at telus.net>






More information about the Pyrex mailing list