I'm running the following code and cannot understand why python thinks that I'm not passing an argument to the endswith
method:
filtered_list = list(filter(str.endswith("mp4"), my_files))
This is the error that I'm getting:
TypeError: endswith() takes at least 1 argument (0 given)
I know I can do the same thing with a lambda
function instead of using the method with the class name, or to use the methodcaller, but I think this way it is shorter and cooler and I don't understand why it doesn't work. Maybe when using a class.method notation I can't pass any arguments and have to use it without paranthases?