Meaning of “with” statement without “as” keyword
The context manager can optionally return an object, to be assigned to the identifier named by as. And it is the object returned by the __enter__ method that is assigned by as, not necessarily the context manager itself. Using as <identifier> helps when you create a new object, like the open() call does, but not … Read more