美文网首页
share memory caused problem

share memory caused problem

作者: zzjack | 来源:发表于2017-10-27 12:39 被阅读0次

using django wrote some view functions.

class resMsg(View):
    SUCCEES = "success"
    GETMSG = "only accept post method"
    def get(self):
        return Httpresponse(self.GETMSG)
    
class one(resMsg):
    def post(self):
        return Httpresponse(self.SUCCEES)
    
class two(resMsg):
    def post(self):
        return Httpresponse(self.SUCCEES)
    
class thee(resMsg):
    def post(self):
        self.SUCCEES = "i am three and success"
        return Httpresponse(self.SUCCEES)

then,wrote a script to request one two threee urls,i found the result like that:

i am three and success
i am three and success
i am three and success

why?because the memory was shared by one two three.And,two changed the memory.

相关文章

网友评论

      本文标题:share memory caused problem

      本文链接:https://www.haomeiwen.com/subject/alerpxtx.html