New submission from Serhiy Storchaka:

Proposed patch adds two features to functions swap_attr() and swap_item() in 
the test.support module.

1. They now work (rather than failing in __exit__) when delete the attribute or 
item inside the with block. There were several cases when I refused to use 
these functions instead of manually coded try/finally due to lack of this 
feature.

2. The original value of the attribute or item can be assigned to the target of 
"as" in the with statement. This can save a line of the code in some cases.

----------
components: Tests
messages: 292527
nosy: ezio.melotti, michael.foord, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Enhance swap_attr() and swap_item() in test.support
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30197>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to