A simpilified code is as follow:
....
class indexHandler(tornado.web.RequestHandler):
a=[]
def callback(self,response):
#Do some other things, like write into database
self.a=[]
def get(self):
print self.a
self.a.append('abc')
client=tornado.httpclient.AsyncHTTPClient()
client.fetch('http://google.com',self.callback)
self.write('OK')
....
When I visit the page first time, the shell shows
[]
.
after page reload, it shows ['abc']
, reload once more then it shows ['abc','abc']
and so on.
Why the a
wouldn't reset?