Python __len__() Magic Method
Syntax object.__len__(self) The Python __len__ method returns a positive integer that represents the length of the object on which it is called. It implements the built-in len() function. For example, if you call len(x) an object x, Python internally calls x.__len__() to determine the length of object x. We call this a “Dunder Method” for … Read more