I don't like the OO part of python. In particular the "self" keyword everywhere.

MRAB python at mrabarnett.plus.com
Thu Jun 11 08:16:57 EDT 2015


On 2015-06-11 12:27, Skybuck Flying wrote:
> Then again...
>
> I also believe the highest goal for a programming language is "natural
> spoken" language.
>
Natural language is full of ambiguities.

> If "self.somefield" equals 10 then...
>
> Does have some understandable ring to it.
>
> However... time constraints also have to be kept in mind.
>
> In another words if the code looks like
>
> begin of class section
>
Shouldn't that be "beginning of class section"?

> if somefield equals 10 then...
>
>
> end of class section
>
You should have a look at Cobol. If was designed with a more natural-
looking syntax so that business managers could write their own code.

It turned out that the managers didn't write code because programming
harder then they anticipated.

Then there's AppleScript. It also tries to have a more natural-looking
syntax, but the problem is that it's then not so clear what's legal.
For example, it allows "title of window" or "window's title". So what
is the title of the script's title? It's "title of window of me" or
"me's window's title". Yes, "me's", not "my". It's an example of the
"Uncanny Valley".

I prefer a language that doesn't look like a natural language, because
it isn't, that's not its purpose.

> Should be pretty obvious that somefield belongs to class section...
>
> So no need to specify self...
>
> If I wanted to access a global variable I would use the existing "global"
> thing
>
> global SomeField...
>
> maybe if I wanted to use a local variable for routine:
>
> local SomeField...
>
> seems nicer... then having to use self everywhere...
>
"then"? Should be "than"... (That seems to be happening more and more
these days...)

Anyway, the use of "self" is something that's not going to change.

If you don't like it, there are plenty of other programming languages
out there for you to try.




More information about the Python-list mailing list