classification
Title: Add support for weak reference to bound methods
Type: enhancement Stage: needs patch
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Instance methods and WeakRefs don't mix.
View: 14631
Assigned To: Nosy List: mark.dickinson, sfeltman
Priority: normal Keywords:

Created on 2012-11-11 09:56 by sfeltman, last changed 2012-11-11 10:19 by mark.dickinson. This issue is now closed.

Messages (3)
msg175337 - (view) Author: Simon Feltman (sfeltman) Date: 2012-11-11 09:56
This is a feature request to include a "WeakMethod" or similar object to the weakref module. The object decomposes a bound method and holds a weakref to the object and unbound function. This can be a very useful utility in signal and ui based programming.

The issue has come up a few times but I was unable to find a bug specifically requesting this feature. I think similar code has shown up in enough libraries at this point that it makes sense to just include it in pythons weakref module.

See also:
http://bugs.python.org/issue813299
http://bugs.python.org/issue7464

This is the recipes:
http://code.activestate.com/recipes/81253/
http://mindtrove.info/python-weak-references/
msg175338 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2012-11-11 09:59
Duplicate of http://bugs.python.org/issue14631 ?
msg175341 - (view) Author: Simon Feltman (sfeltman) Date: 2012-11-11 10:08
Indeed a duplicate of: http://bugs.python.org/issue14631
History
Date User Action Args
2012-11-11 10:19:04mark.dickinsonsetsuperseder: Instance methods and WeakRefs don't mix.
2012-11-11 10:08:52sfeltmansetstatus: open -> closed
resolution: duplicate
messages: + msg175341
2012-11-11 10:00:47mark.dickinsonsetcomponents: + Library (Lib), - None
versions: + Python 3.4
2012-11-11 10:00:31mark.dickinsonsetstage: needs patch
2012-11-11 09:59:59mark.dickinsonsetnosy: + mark.dickinson
messages: + msg175338
2012-11-11 09:56:06sfeltmancreate