[Pyrex] status of weakref support?

Lenard Lindstrom len-l at telus.net
Mon Dec 13 05:31:06 CET 2004


On Sun, 12 Dec 2004 20:49:09 +0100 Yann Vernier <yann at donkey.dyndns.org> wrote:

> On Sun, Dec 12, 2004 at 10:28:47AM -0800, Lenard Lindstrom wrote:
> > On Sat, 11 Dec 2004 20:36:48 +0100 Martijn Faassen <faassen at infrae.com> wrote:
> > > class Element(ElementBase):
> > >      __slots__ = ['__weakref__']
> 
> > > What's the thinking on what this mechanism should look like in Pyrex?
> 
> > That would depend on whether or not weak referencing is available by
> > default. The thread did not include a final decision. If optional maybe:
> > 
> > cdef class C:
> >     cdef object weakref
> > 
> > Telling Pyrex to omit weak referencing when provided by default might
> > require some new syntax, a pragma keyword or something.
> 
> To me it seems like it should rather be:
> 
> cdef class C:
>     cdef public object weakref
> 
> since the weakref slot should be accessible from Python without knowing
> the Pyrex type. 
> 
Check type file. File instances support weak references yet have no
__weakref__ attributes. __weakref__ is characteristic of new-style
classes, not extension types. So there is no reason to make the
weakref slot visible. Besides, if it is exposed it should be readonly.

Lenard Lindstrom
<len-l at telus.net>





More information about the Pyrex mailing list