On Sat, 6 Aug 2016 10:13 am, Chris Angelico wrote: > On Sat, Aug 6, 2016 at 9:21 AM, Marco Sulla > <mail.python....@marco.sulla.e4ward.com> wrote: >> I want to clarify that when I say "different from the other >> languages", I mean "different from the most used languages", that in >> my mind are C/C++, C#, Java, PHP and Javascript, mainly. >> > > Ah, well, that's because those are all one family of languages. If > instead you were familiar with four LISPy languages, you'd have a > completely different set of expectations.
Furthermore, that's only six languages out of, what, a couple of thousand known programming languages? And even languages clearly in the C family, like Objective-C, D, Swift, Java and Go, can end up using quite different syntax and execution models. It amuses me when people know a handful of languages, all clearly derived from each other, and think that's "most" languages. That's like somebody who knows Dutch, Afrikaans and German[1] being surprised that Russian, Cantonese, Hebrew and Vietnamese don't follow the same language rules as "most languages". >> I agree it's not hard to understand that `str` is the string type and >> `len()` is the function that gives you the length, even if you don't >> know Python (and it's shorter to type...) But it's hard to remember, >> in particular if you code also in other languages. When I come back to >> Python, I always ends to write `somelist.length` instead of >> `len(somelist)`, some arcane words come out my mouth and a little >> fairy dies. The obvious solution to that is that those other languages should replace their various list.length, collection.size, group.len, etc methods with a single function, like Python does. Why Python uses a len() function rather than a length/size/len/whatever method: http://effbot.org/pyfaq/why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list.htm [1] Low German, of course, not High German, the same branch of German which lead to Anglo-Saxon and hence to English. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list