New submission from Nick Coghlan:

I was just looking at weakref.finalize objects trying to figure out if they 
solve a problem I'm thinking about (they do), and I couldn't figure out from 
the class documentation ([1]) whether or not I needed to take care of keeping 
the object returned from weakref.finalize alive.

I don't (the module keeps finalizers alive automatically), but this critical 
piece of information is only mentioned in the example much further down in the 
documentation ([2]).

[1] http://docs.python.org/dev/library/weakref#weakref.finalize
[2] http://docs.python.org/dev/library/weakref#finalizer-objects

The 3.4 What's New should also explicitly mention weakref.finalize as an 
alternative to __del__ methods (perhaps as a comment in the section on PEP 422, 
perhaps just in the weakref section)

----------
assignee: docs@python
components: Documentation
messages: 198046
nosy: docs@python, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Clarify weakref.finalize objects are kept alive automatically
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19047>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to