This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author alex
Recipients alex, docs@python
Date 2014-03-30.18:15:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1396203313.39.0.663002564911.issue21105@psf.upfronthosting.co.za>
In-reply-to
Content
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'
History
Date User Action Args
2014-03-30 18:15:13alexsetrecipients: + alex, docs@python
2014-03-30 18:15:13alexsetmessageid: <1396203313.39.0.663002564911.issue21105@psf.upfronthosting.co.za>
2014-03-30 18:15:13alexlinkissue21105 messages
2014-03-30 18:15:12alexcreate