Abstract classes and PyMongo; can't instantiate abstract class
问题 I created the empty abstract class AbstractStorage and inherited the Storage class from it: import abc import pymongo as mongo host = mongo.MongoClient() print(host.alive()) # True class AbstractStorage(metaclass=abc.ABCMeta): pass class Storage(AbstractStorage): dbh = host def __init__(self): print('__init__') Storage() I expected the output to be True __init__ however, the one I'm getting is True Traceback (most recent call last): File "/home/vaultah/run.py", line 16, in <module> Storage()