On 6 August 2016 at 03:14, Steven D'Aprano <steve+pyt...@pearwood.info> wrote:
> On Sat, 6 Aug 2016 08:00 am, Marco Sulla wrote:
>> I'm referring to:
>> * `except` instead of `catch`
>
> Because this isn't a game of "catch the ball". They're called "exceptions",
> not "catchions". You *try* something, and if an *exception* happens, the
> except block runs.

So if I try to pick up a girl, I have to knock back the refuse?


>> * `self` instead of `this` (I know, it's not enforced, but it's a de
>> facto standard and some IDEs like PyDev gives you an error if you
>> declare a non-static method without `self` as first parameter)
>
> Because "this" is a stupid name.
>
> In English, we refer to ourselves in the first person as I, me, myself, and
> sometimes "self", never as "this". One can say "this one has a hat", for
> example, but it sounds weird, like something the Borg would say about a
> specific Borg unit.

It's simply a matter of point of view. In the point of view of class,
you are referring to the class itself, so "self" it's a good word.
>From the point of view of the programmer, you're referring to this
class, so "this" is a good word as well. I don't see a semantic
advantage of "self".


>> * `dict` instead of `map`
>
> Because "map" is a piece of paper showing a visual representation of a
> territory, and a dict (dictionary) is a set of words (the keys) followed by
> their definitions (the values).

If map is only a piece of paper, dictionary is only a book, isn't it?
Dictionary is a book, and inside it there's a set of words followed by
their definitions, as you said.
Map is a piece of paper, and every element of the map represent some
other element, in a 1-1 relationship.


>> * `str.strip()` instead of `str.trim()`
>
> Because "trim" is a stupid name for stripping whitespace from the ends of a
> string. When you trim hair or a plant, you unconditionally cut it and make
> it shorter.

Not at all. "trim" word is used when you have to remove something that
is useless, usually. On the contrary, "strip" can be used also in
other means.


>> * `True`, `False` and None instead of `true`, `false` and `none` (they
>> seems classes)
>
> You'd have to ask other languages why they use 'true', 'false' and 'none'
> (they seem like ordinary variables).

I think you find the reason. Not sure it was a good idea (also vim has
syntax highlighting).


>> * and furthermore much abbreviation, like `str` instead of `string`
>> and `len()` instead of `length()`, that seems to contrast with the
>> readability goal of Python.
>
> Just because something is short doesn't make it less readable. According to
> Wolfram Alpha, the average length of words in English is 5.1 characters:
>
> http://www.wolframalpha.com/input/?i=average+english+word+length
>
> but of the ten most common words themselves, nine are of three or fewer
> characters:
>
> "the of to and a in is it you that"

And according to Wolfram Alpha, the readability of Huckleberry Finn is
5.5. I think it doesn't fit in this discussion in the same way :P
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to