[issue29134] contextlib doc bug
YoSTEALTH
report at bugs.python.org
Mon Jan 2 14:50:59 EST 2017
YoSTEALTH added the comment:
@SilentGhost
You are right, I see it now!
If this is the case maybe "ContextBaseClass" should be changed to "UserDefinedContextClass" (or something...) having "Base" in the class name was confusing, since module "io" has IOBase class that refer to its "base class" figured it was the same concept for contextlib as well.
Also it would be nice if example was improved a bit.
Another Idea:
- why not have an empty context manager base class? like:
def ContextBase:
def __enter__(self):
return self
def __exit__(self, *errors):
pass
This is something anyone can use to extend their class to support context manager? I actually have a class like this i have used many times in my projects! Its simple yet useful.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29134>
_______________________________________
More information about the Python-bugs-list
mailing list