classification
Title: Error in FAQ entry '4.25 Why doesn't Python have a "with" statement for attribute assignments?'
Type: Stage:
Components: Documentation Versions: Python 2.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: eric.smith, georg.brandl
Priority: normal Keywords:

Created on 2009-12-12 12:16 by eric.smith, last changed 2009-12-20 14:28 by georg.brandl. This issue is now closed.

Messages (4)
msg96291 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2009-12-12 12:16
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
msg96634 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-12-19 18:18
Where can I find this?
msg96638 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2009-12-19 18:28
It's in the last sentence of this section:

http://www.python.org/doc/faq/general/#why-doesn-t-python-have-a-with-statement-for-attribute-assignments
msg96684 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-12-20 14:28
This sentence has already been removed from the version of the FAQ that
is now in the source tree:
http://docs.python.org/dev/faq/design.html#why-doesn-t-python-have-a-with-statement-for-attribute-assignments
History
Date User Action Args
2009-12-20 14:28:52georg.brandlsetstatus: open -> closed
resolution: out of date
messages: + msg96684
2009-12-19 18:28:50eric.smithsetmessages: + msg96638
2009-12-19 18:18:38georg.brandlsetmessages: + msg96634
2009-12-12 12:16:36eric.smithcreate