10.1 Polymorphism vs. Function Passing
class Dog:
def __init__(self, name, size):
self.name = name
self.size = size
def __gt__(self, other):
return self.size > other.sizedef get_the_max(x):
max_value = x[0]
for item in x:
if item > max_value:
max_value = item
return max_value
max_dog = get_the_max(doglist)Previous10. Inheritance II: Subtype Polymorphism, Comparators, Comparables, Generic FunctionsNext10.2 Comparables and Comparators
Last updated