class TestSpeedRetrieval(webapp.RequestHandler):
"""
Test retrieval times of various important records in the BigTable database
"""
def get(self):
commandValidated = True
beginTime = time()
itemList = Subscriber.all().fetch(1000)
for item in itemList:
pass
endTime = time()
self.response.out.write("<br/>Subscribers count=" + str(len(itemList)) +
" Duration=" + duration(beginTime,endTime))
我如何将上述内容转化为一个函数,其中我需要传递类的名称?
在上面的例子中,`Subscriber`(在`Subscriber.all().fetch`语句中)是一个类名,它用于使用Python定义Google BigTable中的数据表。我想要做这样的事情:
TestRetrievalOfClass(Subscriber)
or TestRetrievalOfClass("Subscriber")
谢谢,Neal Walters