[New-bugs-announce] [issue7485] Error in FAQ entry '4.25 Why doesn't Python have a "with" statement for attribute assignments?'

Eric Smith report at bugs.python.org
Sat Dec 12 13:16:37 CET 2009


New submission from Eric Smith <eric at trueblade.com>:

The documentation says: "If the referenced object does not have a, b and
c attributes, of course, the end result is still a run-time exception."

For the given example, this is likely not true. Since the attributes are
being assigned to, they will be created. The example is equivalent to:

>>> class a(object): pass
...
>>> ref = a()
>>> ref.a = 21
>>> ref.b = 42
>>> ref.c = 63

----------
assignee: georg.brandl
components: Documentation
messages: 96291
nosy: eric.smith, georg.brandl
severity: normal
status: open
title: Error in FAQ entry '4.25   Why doesn't Python have a "with" statement for attribute assignments?'
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7485>
_______________________________________


More information about the New-bugs-announce mailing list