DEV Community

Discussion on: How to Get an Object Length

 
sebvercammen profile image
Sébastien Vercammen

Clarifying meaning isn't pedantic.

Using size and capacity instead of length on data structures with dynamic lengths was done before JS.

There was probably a discussion somewhere, where they argued for/against both.

Python implements len() as a function with the magic method __len__ precisely to have one consistent way of retrieving an intuitive "length".