I’m new to Python. I have a method that begins:
def foo(self, list):
length = len(list)
I’ve called len() successfully in other cases, but here I get:
TypeError: object of type 'type' has no len()
How do I convince Python that this object passed in is a list? What am I missing?
Because
listis the name of the list type.Use a different name.
And make sure you didn’t call
foolike this: