def foo(x, y):
return x.bar(y) * 2
class Test1:
def bar(self, arg):
return len(arg)
class Test2:
def bar(self, arg):
return arg.split(" ")
t1 = Test1()
t2 = Test2()
foo(t1, [1,2,3,4])
foo(t2, "is this the real life? Or is this just fantasy")
[1,2,3,4] + 5
class MyList(list):
def __add__(self, x):
self.append(x)
ml = MyList([1,2,3,4])
ml
ml + 5
ml