4 ms·
What an extraordinarily patronising response ! Firstly, not 'scared', 'scarred' - merely a bit of harmless hyperbole to indicate a briefly frustrating situatio
by tragomaskhalos 4y ago
What an extraordinarily patronising response !
Firstly, not 'scared', 'scarred' - merely a bit of harmless hyperbole to indicate a briefly frustrating situation.
Secondly, this is not monkeys-at-typewriters, merely an expectation that Python would conform to any other object-based language and have a public method on string to report its length. This should be a discoverable, not an RTFM case.
- doteka 4y agoWhile I agree with you the grandparent was unnecessarily patronizing, they do have a point. “Built-in functions” is the first chapter of the documentation following the introduction, there’s no way to miss it. If you don’t even skim the introductory documentation, I’m not exactly sure what you expect to happen. Python is not Ruby nor is it Java, and it predates both. Why would it follow the idioms of those languages?
- orf 4y agoIt 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!