Re: [Python-ideas] PEP: Shorthand Symbol for "self"

On Sun, Aug 24, 2008 at 9:39 PM, Brett Cannon <brett@python.org> wrote:
First, "self." conveys no more "information" than the "$" I am proposing, but it requires five times as many characters. If that's not clutter, I don't know what is. Second, "self." actually conveys *less* information than "$", because it's meaning depends on whether or not the first formal argument was actually "self". For the record, I gladly concede that I probably don't know as much about Python as most of the other people on this mailing list (as I wrote earlier, I am an aerospace engineer). But I also sense that many Python experts have a blind spot on this matter for some reason. I guess these folks are just so used to seeing "self." everywhere that it has burned itself into their brain to the point that they don't see it as the clutter that it is.

I agree with Brett. While it's true that $ is four character shorter than 'self.', it also loses expressiveness by doing so. The point here seems to be that it distinguishes local variables with instance variables. Whereas 'self.' conveys the idea that this is an instance variable clearly, a symbol such as '$' or '@' does not. It's also true that using 'self' is a convention -- you can easily use 's'. So if you're enough of a nutcase to REALLY want to save those precious four extra characters, well, you can save three. Meanwhile, adding @ or $ to syntax would confuse a well-established, well-understood, and newbie-friendly practice and complicate the language's grammar. Not to mention, prefixing a variable with $ might be distracting to programmers who do PHP for a living. Yet another mental load to bear. It is not a blind spot. I have said before, if not on this list, then to fellow programmers, that I like Python because 'self.' is not implicit or substituted with a symbol that I don't automatically grok. This is, in my opinion, what Brett meant by self-documenting, and I'm inclined to agree. I don't like programming in languages that don't make as clear a distinction between local variables and instance variables. And it's not because I'm used to programming in Python, either, as I am a student have seen more Java code than Python, and took up Python as a hobby. Perhaps it is you who, having (possibly) seen implicit or abbreviated instance variables day in and day out, have burnt them into *your* brain. I certainly haven't. --Andy On Sun, Aug 24, 2008 at 10:04 PM, Russ Paielli <russ.paielli@gmail.com>wrote:

On Sun, Aug 24, 2008 at 11:10 PM, Andrew Akira Toulouse <andrew@atoulou.se>wrote:
Yes it does. Or, rather, it could if allowed to do so. The notion that Python programmers are too simple minded to adapt to a simple notational convention seems a bit bizarre to me. Of course it does not seem "natural" to you yet, because it is a new idea and you have not had a chance to grow accustomed to it. But I think that anyone with half or more of a brain could become completely comfortable with the idea within an hour or two if they would just give a chance. --Russ

Then what of the notion that you are not too simple-minded to adapt to a simple notational convention? Or your conjecture that Python programmers are too accustomed to 'self.' to see it for the clutter it is. Could I not, by the same reasoning, say that you are too accustomed to $ to see its arbitrary and highly overloaded meaning? Could you not become accustomed to 'self.' if you give it a chance? I think you could. --Andy (sorry Russ for the double-email, I forgot to reply-all) On Sun, Aug 24, 2008 at 11:29 PM, Russ Paielli <russ.paielli@gmail.com>wrote:

On Sun, Aug 24, 2008, Russ Paielli wrote:
Consider that most of us came to Python from some other background, most notably P*** -- and in many cases, things like dollar signs were part of we're escaping. -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/ Adopt A Process -- stop killing all your children!

Russ Paielli wrote:
The notion that Python programmers are too simple minded to adapt to a simple notational convention seems a bit bizarre to me.
I'd just like to point out that accusing someone of being too simple-minded to understand one's proposal may not be the best way of getting them to listen to it. -- Greg

On Mon, Aug 25, 2008 at 5:54 PM, Greg Ewing <greg.ewing@canterbury.ac.nz>wrote:
I was suggesting exactly the opposite. I was suggesting that those who are *against* my proposal seem to think that Python programmers are too simple-minded to handle it. --Russ

I agree with Brett. While it's true that $ is four character shorter than 'self.', it also loses expressiveness by doing so. The point here seems to be that it distinguishes local variables with instance variables. Whereas 'self.' conveys the idea that this is an instance variable clearly, a symbol such as '$' or '@' does not. It's also true that using 'self' is a convention -- you can easily use 's'. So if you're enough of a nutcase to REALLY want to save those precious four extra characters, well, you can save three. Meanwhile, adding @ or $ to syntax would confuse a well-established, well-understood, and newbie-friendly practice and complicate the language's grammar. Not to mention, prefixing a variable with $ might be distracting to programmers who do PHP for a living. Yet another mental load to bear. It is not a blind spot. I have said before, if not on this list, then to fellow programmers, that I like Python because 'self.' is not implicit or substituted with a symbol that I don't automatically grok. This is, in my opinion, what Brett meant by self-documenting, and I'm inclined to agree. I don't like programming in languages that don't make as clear a distinction between local variables and instance variables. And it's not because I'm used to programming in Python, either, as I am a student have seen more Java code than Python, and took up Python as a hobby. Perhaps it is you who, having (possibly) seen implicit or abbreviated instance variables day in and day out, have burnt them into *your* brain. I certainly haven't. --Andy On Sun, Aug 24, 2008 at 10:04 PM, Russ Paielli <russ.paielli@gmail.com>wrote:

On Sun, Aug 24, 2008 at 11:10 PM, Andrew Akira Toulouse <andrew@atoulou.se>wrote:
Yes it does. Or, rather, it could if allowed to do so. The notion that Python programmers are too simple minded to adapt to a simple notational convention seems a bit bizarre to me. Of course it does not seem "natural" to you yet, because it is a new idea and you have not had a chance to grow accustomed to it. But I think that anyone with half or more of a brain could become completely comfortable with the idea within an hour or two if they would just give a chance. --Russ

Then what of the notion that you are not too simple-minded to adapt to a simple notational convention? Or your conjecture that Python programmers are too accustomed to 'self.' to see it for the clutter it is. Could I not, by the same reasoning, say that you are too accustomed to $ to see its arbitrary and highly overloaded meaning? Could you not become accustomed to 'self.' if you give it a chance? I think you could. --Andy (sorry Russ for the double-email, I forgot to reply-all) On Sun, Aug 24, 2008 at 11:29 PM, Russ Paielli <russ.paielli@gmail.com>wrote:

On Sun, Aug 24, 2008, Russ Paielli wrote:
Consider that most of us came to Python from some other background, most notably P*** -- and in many cases, things like dollar signs were part of we're escaping. -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/ Adopt A Process -- stop killing all your children!

Russ Paielli wrote:
The notion that Python programmers are too simple minded to adapt to a simple notational convention seems a bit bizarre to me.
I'd just like to point out that accusing someone of being too simple-minded to understand one's proposal may not be the best way of getting them to listen to it. -- Greg

On Mon, Aug 25, 2008 at 5:54 PM, Greg Ewing <greg.ewing@canterbury.ac.nz>wrote:
I was suggesting exactly the opposite. I was suggesting that those who are *against* my proposal seem to think that Python programmers are too simple-minded to handle it. --Russ
participants (4)
-
Aahz
-
Andrew Akira Toulouse
-
Greg Ewing
-
Russ Paielli