我也不懂是啥 先把代码敲一遍记下来
class Celsius:
def __init__(self, value = 26):
self.value = float(value)
def __get__(self, instance, owner):
return self.value
def __set__(self, instence, value):
self.value = float(value)
class Fahrenheit:
def __get__(self, instence, owner):
return instence.cel * 1.8 +32
def __set__(self, instence, value):
instence.cel = (float(value)-32)/1.8
class Temperature:
cel = Celsius()
fah = Fahrenheit()