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.

classification
Title: Stray parentheses() in context manager "what's new" doc
Type: Stage:
Components: Documentation Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: eddy, georg.brandl
Priority: normal Keywords:

Created on 2010-02-14 06:52 by eddy, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg99336 - (view) Author: Edward Welbourne (eddy) Date: 2010-02-14 06:52
http://docs.python.org/whatsnew/2.6.html#writing-context-managers
penultimate item in "A high-level explanation": <quote>
If BLOCK raises an exception, the __exit__(type, value, traceback)() is called 
</quote> has extra () after the argument list - this appears to say that __exit__ should return a callable, that shall be called with no parameters.  Fortunately, later example code reveals that __exit__ simply returns true or false.

http://docs.python.org/whatsnew/2.6.html#the-contextlib-module
after the first code block: <quote>
The contextlib module also has a nested(mgr1, mgr2, ...)() function 
</quote> again, stray () after parameter list.
After the next short code snippet: <quote>
Finally, the closing(object)() function returns ...
</quote>
msg99338 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-02-14 08:18
Fixed in r78182.
msg99341 - (view) Author: Edward Welbourne (eddy) Date: 2010-02-14 11:48
The third change removes the early uses of "object" from:
<quote> Finally, the closing(object)() function returns object so that it can be bound to a variable, and calls object.close at the end of the block. </quote>
leaving the last use (object.close) as a dangling reference.
So either revert this part of the fix and change :func:`closing(object)` to just ``closing(object)`` or follow up the present change by changing <quote> and calls :meth `object.close` at the end </quote> to <q> and calls the argument's :meth:`close` method at the end </q>
msg99343 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-02-14 13:38
Thanks, should be fine now in r78188.
msg99345 - (view) Author: Edward Welbourne (eddy) Date: 2010-02-14 15:24
Nice :-)
History
Date User Action Args
2022-04-11 14:56:57adminsetgithub: 52174
2010-02-14 15:24:52eddysetmessages: + msg99345
2010-02-14 13:38:27georg.brandlsetstatus: open -> closed

messages: + msg99343
2010-02-14 11:48:16eddysetstatus: closed -> open

messages: + msg99341
2010-02-14 08:18:48georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg99338
2010-02-14 06:52:14eddycreate