Author walker.hale.iv
Recipients walker.hale.iv
Date 2016-10-24.02:36:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
contextlib.ExitStack implies but does not explicitly state that its __enter__ method trivially returns self.

This means that if a user invokes pop_all and then uses the resulting ExitStack instance in a with statement, the user will be relying on undocumented behavior. Avoiding undocumented behavior forces the user to instead use a tedious try/finally construct, partially defeating the elegance of context managers.

I propose that:

1. The ExitStack.__enter__ method be briefly mentioned as doing nothing besides returning self.

2. The example in pop_all documentation be expanded to show a following with statement that uses the new ExitStack instance.

The discussion in section is not sufficient to make this trivial point clear.
Date User Action Args
2016-10-24 02:36:51walker.hale.ivsetrecipients: + walker.hale.iv
2016-10-24 02:36:51walker.hale.ivsetmessageid: <>
2016-10-24 02:36:51walker.hale.ivlinkissue28516 messages
2016-10-24 02:36:50walker.hale.ivcreate