Title: Theory / Unimportant / CS / Programming / Python / Lib / built-in types / Context
Tags: computer_to_instruction automatedNewLineAfterCommaSpace

Instruction: c.__enter__()
Page: https://docs.python.org/3.7/library/stdtypes.html#context-manager-types
Effect: Enter the runtime context
Language: Python
Returns: either this object or another object related to the runtime context. The value returned by this method is bound to the identifier in the as clause of with statements using this context manager.
Variables: c a context manager
Example: An example of a context manager that returns itself is a file object. File objects return themselves from __enter__() to allow open() to be used as the context expression in a with statement.
An example of a context manager that returns a related object is the one returned by decimal.localcontext(). These managers set the active decimal context to a copy of the original decimal context and then return the copy. This allows changes to be made to the current decimal context in the body of the with statement without affecting code outside the with statement.

Instruction: c.__exit__(
  exc_type,
  exc_val,
  exc_tb
)
Page: https://docs.python.org/3.7/library/stdtypes.html#context-manager-types
Effect: exit the runtime context
Language: Python
Returns: a Boolean flag indicating if any exception that occurred should be suppressed
Variables: c a context manager
Assuming: do not reraise in the method