Author brett.cannon
Recipients Nan Wu, brett.cannon, gvanrossum, rhettinger
Date 2015-11-16.18:58:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1447700294.7.0.0199799457793.issue25609@psf.upfronthosting.co.za>
In-reply-to
Content
The reason I suggested the ABC for context managers is mostly to provide a way to help people make sure to implement __enter__() and to provide a default __exit__() which has the proper signature (I personally always forget how many arguments __exit__() takes and what the arguments are past the first one). The type part of this feature request is because I realized that a type hint of "context manager" isn't really useful, but "context manager returning ..." is since a `with` statement does introduce a new variable. IOW none of this has anything to do with isinstance() and it's all about easing the use of the context manager interface and proper type hints for the `with` statement.

As for a new module analogous to the `types` module just for ABCs, that's fine by me. I had the same reaction you did, Raymond, about putting it in collections.abc. I can open another issue for that idea and leave this open as it's somewhat orthogonal to what I'm proposing.
History
Date User Action Args
2015-11-16 18:58:14brett.cannonsetrecipients: + brett.cannon, gvanrossum, rhettinger, Nan Wu
2015-11-16 18:58:14brett.cannonsetmessageid: <1447700294.7.0.0199799457793.issue25609@psf.upfronthosting.co.za>
2015-11-16 18:58:14brett.cannonlinkissue25609 messages
2015-11-16 18:58:14brett.cannoncreate