Simply put, you are trying to use a method that the function did not have. Also functions do not have methods, classes have methods.
def __init__(self, lst):
self.lst = lst
def extend_list(self, *args, **kwargs):
for arg in args:
for karg in kwargs:
lst = ListExtender(['a', 'b', 'c'])
lst.extend_list(['d', 'e', 'f'])
lst.extend_list('g', 'h', 'i')
Now from my code here you can see I create a class and give it a method that extends the list. I also overrode the
__str__ method for it so that it would return a str of it's lst property.
Easy enough? Now remember that functions do not have methods at all, if you want to work on data returned by one function in another you can do that.
a = 5
b = sum(a * sum(a * sum(a * 3))) # Working on the result of a function is easy
If you still do not get what's going on feel free to ask.