3 ms·
> On the other hand, in Python lists, tuples and arrays are fundamental data types and thus len() is defined as a fundamental built-in function. I think it make
by bhaak 9y ago
> On the other hand, in Python lists, tuples and arrays are fundamental data types and thus len() is defined as a fundamental built-in function. I think it makes sense.
But len() is only a fundamental built-in function for fundamental data types and you can implement it on any class by implementing the method __len__(self).
For those it doesn't make sense any longer to be able to do len(x).
- flavio81 9y agoI'm afraid you're right...