[Python-Dev] weakattr

tomer filiba tomerfiliba at gmail.com
Mon Jul 3 19:00:09 CEST 2006


> I like the added functionality offered with weakattrs as defined.  I'm
> not terribly in love with the syntax of their creation, and I'm curious
> as to how it plays with __slots__
weakattrs are data descriptors, just like properties etc. they are part
of the class, not the instance, so there shouldn't be any trouble with
mixing those with __slots__

moreover, adding those to stdlib is very staight-forward. we don't even
need to introduce a new module. if people show interest, i'll write a
bit of a longer doc string and add some unit tests (although there's
not much to test :) )

> Toss it out in python-list, I think some people over there would be able
> to offer more feedback.
will do... although i doubt they will offer any



-tomer

On 7/2/06, Josiah Carlson <jcarlson at uci.edu> wrote:
>
> "tomer filiba" <tomerfiliba at gmail.com> wrote:
> > weakattr (weak attributes) are attributes that are weakly referenced
> > by their containing object. they are very useful for cyclic references --
> > an object that holds a reference to itself.
>
> I like the added functionality offered with weakattrs as defined.  I'm
> not terribly in love with the syntax of their creation, and I'm curious
> as to how it plays with __slots__ (not quite having the time to look at
> its implementation right now), but it is quite explicit, so I can get
> past that. It would allow us to say, "stop using __del__, use weakattrs",
> but I'm not sure how well that would work, generally.
>
> Toss it out in python-list, I think some people over there would be able
> to offer more feedback.
>
>  - Josiah
>
>


More information about the Python-Dev mailing list