Skip to content Skip to sidebar Skip to footer

With Statement In Python Is Returning None Object Even Though __init__ Method Works

For a DB class with the following init method: class DB: def __init__(self, dbprops): self.dbprops = dbprops self.conn = self.get_connection(self.dbprops)

Solution 1:

The context manager protocol is handled by the __enter__() and __exit__() methods; the former must return the value to assign.


Post a Comment for "With Statement In Python Is Returning None Object Even Though __init__ Method Works"