Which special method makes len(obj) work in Python?
Correct answer
D. __len__
12 views
D. __len__
12 views
Defining __len__ lets objects work with len().
Asked in: Python Interview OOP
https://docs.python.org/3/tutorial/classes.htmlNot sure why the answer is D? Ask here and get an explanation.