class Time:
def __init__(self, hours, minutes):
self.hours = hours
self.minutes = minutes
self.hours, self.minutes = Time.func(hours, minutes)
@staticmethod
def func(hours, minutes):
return hours, minutes
def __add__(self, other):
if isinstance(other, Time):
c = [self.hours + other.hours, self.minutes + other.minutes]
for i in range(len(c)):
c = str(c)
return Time(c[0], c[1])
else:
return NotImplemented
p = Time(2, 30)
p1 = Time(6, 25)
print(p + p1)
Почему этот код выдаёт ссылку , а не значение?
def __init__(self, hours, minutes):
self.hours = hours
self.minutes = minutes
self.hours, self.minutes = Time.func(hours, minutes)
@staticmethod
def func(hours, minutes):
return hours, minutes
def __add__(self, other):
if isinstance(other, Time):
c = [self.hours + other.hours, self.minutes + other.minutes]
for i in range(len(c)):
c = str(c)
return Time(c[0], c[1])
else:
return NotImplemented
p = Time(2, 30)
p1 = Time(6, 25)
print(p + p1)
Почему этот код выдаёт ссылку , а не значение?