Re: [Python-3000] weakrefs of bound methods

2008-02-17 Thread Phillip J. Eby
At 09:29 AM 2/17/2008 +, Nick Craig-Wood wrote: >On Fri, Feb 15, 2008 at 01:20:03PM -0800, Guido van Rossum wrote: > > But maybe given how rare the use case is, it would be easier to just > > create a custom class in weakref.py that does what Nick requested. > >I still don't like the silent fai

Re: [Python-3000] weakrefs of bound methods

2008-02-17 Thread Nick Craig-Wood
Greg Ewing <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > But maybe given how rare the use case is, it would be easier to just > > create a custom class in weakref.py that does what Nick requested. > > Nick would still forget to use it and get strange bugs > in his code, though! More

Re: [Python-3000] weakrefs of bound methods

2008-02-17 Thread Nick Craig-Wood
On Fri, Feb 15, 2008 at 01:20:03PM -0800, Guido van Rossum wrote: > But maybe given how rare the use case is, it would be easier to just > create a custom class in weakref.py that does what Nick requested. I still don't like the silent failure, but a noisy failure and a custom class would be great

Re: [Python-3000] weakrefs of bound methods

2008-02-15 Thread Greg Ewing
Guido van Rossum wrote: > But maybe given how rare the use case is, it would be easier to just > create a custom class in weakref.py that does what Nick requested. Nick would still forget to use it and get strange bugs in his code, though! -- Greg ___

Re: [Python-3000] weakrefs of bound methods

2008-02-15 Thread Greg Ewing
Phillip J. Eby wrote: > The part I'm not > immediately sure of is where to call it *from*, so that you can still > subclass weakref.ref and not end up in a strange delegation loop. The function for creating a weak ref would need to be different from the weakref class itself. One of them would ha

Re: [Python-3000] weakrefs of bound methods

2008-02-15 Thread Guido van Rossum
On Fri, Feb 15, 2008 at 12:52 PM, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 11:41 AM 2/15/2008 -0800, Guido van Rossum wrote: > >On Fri, Feb 15, 2008 at 10:26 AM, Phillip J. Eby > ><[EMAIL PROTECTED]> wrote: > > > > I've never actually encountered a usecase for keeping a standard > > > we

Re: [Python-3000] weakrefs of bound methods

2008-02-15 Thread Phillip J. Eby
At 11:41 AM 2/15/2008 -0800, Guido van Rossum wrote: >On Fri, Feb 15, 2008 at 10:26 AM, Phillip J. Eby ><[EMAIL PROTECTED]> wrote: > > I've never actually encountered a usecase for keeping a standard > > weakref to a standard bound method, though. It's pretty useless, > > because bound methods

Re: [Python-3000] weakrefs of bound methods

2008-02-15 Thread Guido van Rossum
On Fri, Feb 15, 2008 at 10:26 AM, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 09:35 AM 2/15/2008 -0800, Guido van Rossum wrote: > >On Fri, Feb 15, 2008 at 2:12 AM, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > > > I've just been bitten yet again by the fact you can't have a weakref > > > to a

Re: [Python-3000] weakrefs of bound methods

2008-02-15 Thread Phillip J. Eby
At 09:35 AM 2/15/2008 -0800, Guido van Rossum wrote: >On Fri, Feb 15, 2008 at 2:12 AM, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > > I've just been bitten yet again by the fact you can't have a weakref > > to a bound method! I find myself wanting to do this whenever I have a > > registry of cal

Re: [Python-3000] weakrefs of bound methods

2008-02-15 Thread Guido van Rossum
On Fri, Feb 15, 2008 at 2:12 AM, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > I've just been bitten yet again by the fact you can't have a weakref > to a bound method! I find myself wanting to do this whenever I have a > registry of callback functions. > > Could we in py3k either > > 1) make w

[Python-3000] weakrefs of bound methods

2008-02-15 Thread Nick Craig-Wood
I've just been bitten yet again by the fact you can't have a weakref to a bound method! I find myself wanting to do this whenever I have a registry of callback functions. Could we in py3k either 1) make weakrefs to bound methods work? A weakref to a bound method should mean hold the weakref on