3 ms·
It does have a public method, __len__(). It’s a protocol method that’s more discoverable than size/length/len/count or whatever other ad-hoc name.
by orf 4y ago
It does have a public method, __len__(). It’s a protocol method that’s more discoverable than size/length/len/count or whatever other ad-hoc name.
- tragomaskhalos 4y agoYes I'm aware, and yes it's 'public' in the sense that all Python methods are but my point was that it is not meant to be called directly. The whole argument as to whether or not this is a superior mechanism was exactly the cause of heated debate the first time around and something I was keen to avoid here!