New submission from Alex Gaynor: Specifically the example at: https://docs.python.org/3/library/functools.html?highlight=functools#functools.partialmethod
``_alive`` isn't actually assigned before the example tries to read it. Running this code at a for-real REPL results in: >>> class Cell(object): ... @property ... def alive(self): ... return self._alive ... def set_state(self, state): ... self._alive = bool(state) ... import functools ... set_alive = functools.partialmethod(set_state, True) ... set_dead = functools.partialmethod(set_state, False) ... >>> c = Cell() >>> c.alive Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 4, in alive AttributeError: 'Cell' object has no attribute '_alive' ---------- assignee: docs@python components: Documentation keywords: easy messages: 215191 nosy: alex, docs@python priority: normal severity: normal status: open title: functools.partialmethod example doesn't actually work versions: Python 3.4, Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21105> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com