Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #92474

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

Date 2015-06-11 13:16 +0100
From MRAB <python@mrabarnett.plus.com>
Subject Re: I don't like the OO part of python. In particular the "self" keyword everywhere.
References <a91ad$55796ed2$5419aafe$46975@news.ziggo.nl> <77496$55797095$5419aafe$48148@news.ziggo.nl>
Newsgroups comp.lang.python
Message-ID <mailman.394.1434025019.13271.python-list@python.org> (permalink)

Show all headers | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

I don't like the OO part of python. In particular the "self" keyword everywhere. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-06-11 13:19 +0200
  Re: I don't like the OO part of python. In particular the "self" keyword everywhere. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-06-11 13:27 +0200
    Re: I don't like the OO part of python. In particular the "self" keyword everywhere. Chris Angelico <rosuav@gmail.com> - 2015-06-11 21:36 +1000
    Re: I don't like the OO part of python. In particular the "self" keyword everywhere. Chris Angelico <rosuav@gmail.com> - 2015-06-11 21:38 +1000
    Re: I don't like the OO part of python. In particular the "self" keyword everywhere. MRAB <python@mrabarnett.plus.com> - 2015-06-11 13:16 +0100
      Re: I don't like the OO part of python. In particular the "self" keyword everywhere. Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2015-06-11 17:32 +0200
  Re: I don't like the OO part of python. In particular the "self" keyword everywhere. Michael Torrie <torriem@gmail.com> - 2015-06-11 08:15 -0600
  Re: I don't like the OO part of python. In particular the "self" keyword everywhere. Rustom Mody <rustompmody@gmail.com> - 2015-06-11 09:39 -0700
  Re: I don't like the OO part of python. In particular the "self" keyword everywhere. sohcahtoa82@gmail.com - 2015-06-11 09:55 -0700

csiph-web