[Python-Dev] weakref enhancements (original) (raw)
tomer filiba tomerfiliba at gmail.com
Thu Sep 28 20:40:34 CEST 2006
- Previous message: [Python-Dev] Collecting 2.4.4 fixes
- Next message: [Python-Dev] weakref enhancements
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
i'd like to suggest adding weak attributes and weak methods to the std weakref module.
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 et al, that returns
"weakly
bound" methods. weakmethod's im_self is a weakref.proxy to self
, which
means
the mere method will not keep the entire instance alive. instead, you'll get
a
ReferenceError.
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 info, examples, and suggested implementation:
-tomer -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20060928/7c3f1fc2/attachment.html
- Previous message: [Python-Dev] Collecting 2.4.4 fixes
- Next message: [Python-Dev] weakref enhancements
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]