[Python] 好笨啊....竟然弄成static了

class CurlSender():
 handle = pycurl.Curl()

 def __init__(self, proxy_setting = None):
  self.handle.setopt(pycurl.PROXY, proxy_setting['host'])

之前不查....直到發現process沒死之前,
就算外面把CurlSender物件del掉再重new
同一個Process裏面Proxy還是不會變啊啊啊啊啊啊啊
〒_〒

正解
class CurlSender():
 handle = None

 def __init__(self, proxy_setting = None):
  self.handle = pycurl.Curl()
  self.handle.setopt(pycurl.PROXY, proxy_setting['host'])

Python的OO真的.....我不懂你



留言