With statement in python is returning None object even though __init__ method works

后端 未结 1 1187

For a DB class with the following init method:

class DB:
    def __init__(self, dbprops):
        self.dbprops = dbprops
        self.conn =         


        
相关标签:
1条回答
  • 2021-01-19 08:50

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

    0 讨论(0)
提交回复
热议问题