我正在使用带有龙卷风的电机。我有以下课程:
class N():
def __init__(self,collectionName host='localhost', port=27017):
self.con=motor.MotorClient(host,port)
self.xDb=self.con.XDb
setattr(self,collectionName,self.xDb[collectionName])
这实际上是我想要扩展的父类。子类会调用这个类的init来设置collectionName。问题是我在这个类中还有一些其他方法,例如
@tornado.gen.coroutine
def dropDB(self):
yield self.xDb.drop_collection(self.COLLECTION??)
上面的内容被破坏了,因为我在init中动态设置了集合,这是我可以确定自我的一种方式。我设置为在基本方法中使用的变量?