python property
class telnetClient(object): def __init__(self,addr,port=23): self.addr=addr # @property # def ip(self): # return self.addr # @ip.setter # def ip(self,ipaddr): # self.addr=ipaddr def getip(self): return self.addr def setip(self,value): self.addr=value property(getip,setip) t=telnetClient("127.0.0.1") # t.ip="127.0.0.2" # print(t.ip)