Nov-28-2020, 12:18 PM
(This post was last modified: Nov-28-2020, 12:18 PM by Gribouillis.)
I don't think
As the documentation says, the return value of
__enter__
takes any argument apart from self. It may return anything.As the documentation says, the return value of
__exit__
is converted into a boolean to see if the potential exception that occurred in the with block should be suppressed or propagated. The default is propagated because functions return None by default.