this may still be premature, but i see people misunderstood the purpose.
weakattrs are not likely to be used "externally", out of the scope of
the object.
they are just meant to provide an easy to use means for not holding cyclic
references between parents and children.
many graph-like structures
Raymond Hettinger wrote:
> Also, I question the utility of maintaining a weakref to a method or
> attribute instead of holding one for the object or class. As long as
> the enclosing object or class lives, so too will their methods and
> attributes. So what is the point of a tighter weakref gr
On 9/28/06, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> > There are *definitely* use cases for keeping bound methods around.
> >
> > Contrived example:
> >
> >one_of = set([1,2,3,4]).__contains__
> >filter(one_of, [2,4,6,8,10])
>
> ISTM, the example shows the (undisputed) utility of regu
> There are *definitely* use cases for keeping bound methods around.
>
> Contrived example:
>
>one_of = set([1,2,3,4]).__contains__
>filter(one_of, [2,4,6,8,10])
ISTM, the example shows the (undisputed) utility of regular bound methods.
How does it show the need for methods bound weakly t
On 9/28/06, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> [Alex Martelli]
>
> >I've had use cases for "weakrefs to boundmethods" (and there IS a
> >Cookbook recipe for them),
> >
> Weakmethods make some sense (though they raise the question of why bound
> methods are being kept when the underlying
[Alex Martelli]
>I've had use cases for "weakrefs to boundmethods" (and there IS a
>Cookbook recipe for them),
>
Weakmethods make some sense (though they raise the question of why bound
methods are being kept when the underlying object is no longer in use --
possibly as unintended side-effect of
On 9/28/06, tomer filiba <[EMAIL PROTECTED]> wrote:
> > I'm sceptical that these would find use in practice.
> > [..]
> > Also, I question the utility of maintaining a weakref to a method or
> > attribute instead of holding one for the object or class. As long as
> > the enclosing object or class
> I'm sceptical that these would find use in practice.> [..]> Also, I question the utility of maintaining a weakref to a method or> attribute instead of holding one for the object or class. As long as
> the enclosing object or class lives, so too will their methods and> attributes. So what is the
> Also, I question the utility of maintaining a weakref to a method or
> attribute instead of holding one for the object or class.
Strike that paragraph -- the proposed weakattrs have references away from the
object, not to the object.
Raymond
___
Py
tomer filiba wrote:
> i'd like to suggest adding weak attributes and weak methods to the std
> weakref
> module.
. . .
>
> i think these two features are quite useful, and being part of the
> stdlib, would
> provide programmers with easy-to-use solutions to object-aliveness issues.
>
> more i
i'd like to suggest adding weak attributes and weak methods to the std weakrefmodule. weakattrs are weakly-referenced attributes. when the value they reference is no longer strongly-referenced by something else, the weakattrs "nullify" themselves.
weakmethod is a method decorator, like classmethod
11 matches
Mail list logo