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.all(). fetch 문에있는 Subscriber는 클래스 이름으로, Google BigTable에서 Python으로 데이터 테이블을 정의하는 방법입니다. 당신이 ""같이 "사이의 코드에서와 같이 직접 클래스 객체를 전달하고 경우Python : 클래스 이름을 함수의 매개 변수로 전달 하시겠습니까?
TestRetrievalOfClass(Subscriber)
or TestRetrievalOfClass("Subscriber")
감사합니다, 닐 월터스
쿨, 난 당신이 다른 모든 변수와 같은 클래스를 전달할 수 몰랐다. 나는 그 연결을 놓치고 있었다. – NealWalters
function, methods, class, modules 모든 것은 파이썬에서 전달할 수있는 first class 객체입니다. –