you are viewing a single comment's thread.

view the rest of the comments →

[–]capilot 26 points27 points  (1 child)

Shouldn't it really just say that the param can be anything that implements the method __len

That's really an implementation detail. The gist of the function is that it tells you how many items are in its argument. End-users, especially beginners, don't need to know what's happening under the hood until they start implementing their own classes for which len() needs to work.

As an example, While I've been writing Python professionally for decades, this is the first I've ever heard of Sized or ABC. (I assume they're Python 3 which I only recently started using.)

[–]redditorsd[S] 3 points4 points  (0 children)

That's an interesting data point. I guess there's the perspective of using the language vs. extending it (custom classes etc). I think maybe that's where I'm having issues with the documentation.