Re: [Python-ideas] Technical possibilities for a syntax [was: Reverse assignment operators ...]

On Thu, Nov 17, 2016 at 07:37:36AM +0100, Mikhail V wrote:
Thank you :-) [...]
In some ways it is. But Python is a conservative language (despite the "radical" feature of significant indentation, but even that was a proven concept from at least one other language, ABC, before Guido used the idea). Things may have been different two decades ago when Python was a brand-new language with a handful of users. Python is a mature language now with a huge user-base. It is probably one of the top five most popular languages in the world, and certainly one of the top ten. We have a responsibility to our users: - to minimise the amount of disruption to their code when they upgrade; - that means avoiding breaking backwards compatibility unless there is significant benefit to make up for the pain; - and long deprecation periods before removing obsolete features; - since it typically takes five years, or even ten, to remove a deprecated feature, we should avoid wasting users' time by adding new and exciting experimental features that turn out to be a bad idea. Nick Coghlan has a good blog post that explains the tension in the Python community between those who want the language to evolve faster, and those who want it to evolve slower: http://www.curiousefficiency.org/posts/2011/04/musings-on-culture-of-python-... For people used to the rapid change in the application space (new versions of Chrome virtually daily; Ubuntu brings out new operating system versions every six months) Python seems to move really, really slowly. But for a programming language, Python moves radically fast: most C code written in the 1970s probably works correctly today, and it can easily be a decade between C versions. [...]
First main question then would be: Are augmented assignment operators needed *much*?
They are. They were one of the most often requested features before Python. Most people consider that they improve the quality of code. [...]
Mikhail, you are missing the point that people have already spent decades thinking about "a better syntax for in-place stuff", and for Python that syntax is augmented assignment. I'm sorry that *you personally* don't like this syntax. That puts you in a very small minority. Not everybody likes every part of Python syntax. But I think it is time for you to give up: you cannot win this battle.
I really, really hope not. Type annotations are irrelevant here. Python doesn't need type annotations to know the type of A at runtime. The advantage of augmented assignment is that it allows me, the programmer, to decide whether or not I want in-place array operations. It is *my* choice, not the compiler's, whether I create a new list: A = B = [1, 2, 3] A = A + [4] assert B == [1, 2, 3] or make the change in-place: A = B = [1, 2, 3] A += [4] assert B == [1, 2, 3, 4] [...]
Those suggestions waste perfectly good and useful variable names as keywords (I have code that uses inc and calc as names, and exec is the name of a built-in function). And not one of those examples makes it clear that this is an assignment. Augmented assignment does make it clear: it uses a variation on the = binding operator. (Its not actually an operator, but for lack of a better name, I'll call it one.) It follows the same basic syntax as regular assignment: target = expression except that he augmented operator is inserted before the equals sign: target -= expression target += expression target *= expression etc. At this point, I think it is a waste of time to continue discussing alternatives to augmented assignment syntax. I'm happy to discuss the culture of Python and how we decide on making changes to the language, but I am not interested in discussing augmented assignment itself. -- Steve

On 18 November 2016 at 01:26, Steven D'Aprano <steve@pearwood.info> wrote:
Fair and honest answer. How one would discuss then about "how we decide on making changes" at all? In this particular case, of course I am not interested in assignment operator *itself* but I am very interested how the judgement on syntax would see, namely I was very interested to see how people would imagine writing something in some other way and how it feels. Thats it. This is kind of too naive, but such questions I think will and should appear. And as I see there are quite a lot of absolutely different opinions on it. Some probably even consider not worth it even looking at examples, since it from beginning will return "syntax error". Yes there were such kind of answers (not in this thread, but still I've seen such approach). I observed the previous thread, where it was asked about changing += to =+, namely change the direction of symbols and there indeed followed a bunch of answers, that a =- 2 will be same as: a = -2 Well, kind of true, but you know, not necesserily the original poster did not know it. And what is much more important, that apart from the compatibility and tradition issue, there could be still something to think about, so one probably should try to "read between the lines" and see how the OP comes to this idea. Yes, it is probably dozen of people (I don't know) who decides for syntax changes, but the amount of potential users is huge and I personally tend to look in the future rather than looking into other languages or worrying *too much* about oldies who got used to some particular syntax. I will become one day an old fart too, but I will never be angry on those who uses better syntax and that my syntax is obsolete now. For me personally switching to new syntax, if it looks better, would be only pleasure and kind of interesting experience. So it depends and I don't want to hurt noboby with that. As for backward compatibility issues: it is not my destiny, but there is an analogy with my earlier discussion about numeric represantations. One wants to keep the amount of Python versions minimal and make minimal changes and thats right. But IMHO one should probably make even less versions of Python and *longer* period before new version, but with *more* radical changes to the syntax, the question is where do you find the people who take responsibilty, that these changes will be good. In similar way, there is no sense to make small corrections to numeric representation or writing, but it is important to keep the work on it and only rarely make radical improvements. A good example is relatively new "format" method for printing strings. I remember reading a thread on SO and I was almost shocked how some people write about it. Even given the fact that nobody prohibited the old % formatter, in some comments I literally feel the hate. And it is really sad, since it is just a change to a better readable syntax. In this moment I really felt sorry for python developers who want to make something good to people and must hear this. I would punish those and take away the % formatter. (that was a joke:). Mikhail

On 18 November 2016 at 01:26, Steven D'Aprano <steve@pearwood.info> wrote: Sorry, just for a second one more comment to your comment. BTW, Steve, there is no any "battle", only peace and pleasure. And exchange of knowledge and opinions of adult intelligents.
Wikipedia says they are all the same in all languages. Probably you meant something else. But if there are alternatives, I would look into it. Especially if they are a product of "decades" of work of titans of typography, this must be something divinely beautiful in contrast to current ones.
[...] not one of those examples makes it clear that this is an assignment.
But is it not because you see it first time in your life? That is just one point on the problem of judgement of syntax, regardless of what it be.
Which makes these two lines: target -= expression target = expression Quite similar visually but with *absolutely* different meaning. Steven, you always give reviews and advices which exceed all expectations in quality and clearness and I learned a lot from you, serious. But I dare me a light nitpick: probably syntaxes is not your element ;) Mikhail

On 11/18/2016 11:19 AM, Mikhail V wrote:
On 18 November 2016 at 01:26, Steven D'Aprano wrote:
I'm not seeing D'Aprano's posts, except in Mikhail's replies -- Mikhail, is he replying directly to you? If so, please stop including Python Ideas in your replies. Thank you. -- ~Ethan~

On Fri, Nov 18, 2016 at 11:31:21AM -0800, Ethan Furman wrote:
I'm not replying off-list, but something has clearly gone wrong with the mailing list. (I'm BCC'ing the list owners.) My earlier post (the one Mikhail has replied to) shows up in the ActiveState archive: http://code.activestate.com/lists/python-ideas/43270/ but not in the official python-list archive: https://mail.python.org/pipermail/python-ideas/2016-November/thread.html Later I see a reply from Ethan to a question posed by Chris Angelico http://code.activestate.com/lists/python-ideas/43276/ but I never received Chris' question. Neither Chris' question nor Ethan's response show up in the pipermail archive. -- Steve

On Sat, Nov 19, 2016 at 10:13 AM, Steven D'Aprano <steve@pearwood.info> wrote:
Part of that is because I actually responded off-list (though I don't mind that it went back on-list). However, Ethan's response should have gone to the list and the archive. ChrisA

On Nov 18 2016, Ethan Furman <ethan-gcWI5d7PMXnvaiG9KC9N7Q@public.gmane.org> wrote:
FWIW, I can see them on Gmane. Best, -Nikolaus -- GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F »Time flies like an arrow, fruit flies like a Banana.«

On 18 November 2016 at 01:26, Steven D'Aprano <steve@pearwood.info> wrote:
Fair and honest answer. How one would discuss then about "how we decide on making changes" at all? In this particular case, of course I am not interested in assignment operator *itself* but I am very interested how the judgement on syntax would see, namely I was very interested to see how people would imagine writing something in some other way and how it feels. Thats it. This is kind of too naive, but such questions I think will and should appear. And as I see there are quite a lot of absolutely different opinions on it. Some probably even consider not worth it even looking at examples, since it from beginning will return "syntax error". Yes there were such kind of answers (not in this thread, but still I've seen such approach). I observed the previous thread, where it was asked about changing += to =+, namely change the direction of symbols and there indeed followed a bunch of answers, that a =- 2 will be same as: a = -2 Well, kind of true, but you know, not necesserily the original poster did not know it. And what is much more important, that apart from the compatibility and tradition issue, there could be still something to think about, so one probably should try to "read between the lines" and see how the OP comes to this idea. Yes, it is probably dozen of people (I don't know) who decides for syntax changes, but the amount of potential users is huge and I personally tend to look in the future rather than looking into other languages or worrying *too much* about oldies who got used to some particular syntax. I will become one day an old fart too, but I will never be angry on those who uses better syntax and that my syntax is obsolete now. For me personally switching to new syntax, if it looks better, would be only pleasure and kind of interesting experience. So it depends and I don't want to hurt noboby with that. As for backward compatibility issues: it is not my destiny, but there is an analogy with my earlier discussion about numeric represantations. One wants to keep the amount of Python versions minimal and make minimal changes and thats right. But IMHO one should probably make even less versions of Python and *longer* period before new version, but with *more* radical changes to the syntax, the question is where do you find the people who take responsibilty, that these changes will be good. In similar way, there is no sense to make small corrections to numeric representation or writing, but it is important to keep the work on it and only rarely make radical improvements. A good example is relatively new "format" method for printing strings. I remember reading a thread on SO and I was almost shocked how some people write about it. Even given the fact that nobody prohibited the old % formatter, in some comments I literally feel the hate. And it is really sad, since it is just a change to a better readable syntax. In this moment I really felt sorry for python developers who want to make something good to people and must hear this. I would punish those and take away the % formatter. (that was a joke:). Mikhail

On 18 November 2016 at 01:26, Steven D'Aprano <steve@pearwood.info> wrote: Sorry, just for a second one more comment to your comment. BTW, Steve, there is no any "battle", only peace and pleasure. And exchange of knowledge and opinions of adult intelligents.
Wikipedia says they are all the same in all languages. Probably you meant something else. But if there are alternatives, I would look into it. Especially if they are a product of "decades" of work of titans of typography, this must be something divinely beautiful in contrast to current ones.
[...] not one of those examples makes it clear that this is an assignment.
But is it not because you see it first time in your life? That is just one point on the problem of judgement of syntax, regardless of what it be.
Which makes these two lines: target -= expression target = expression Quite similar visually but with *absolutely* different meaning. Steven, you always give reviews and advices which exceed all expectations in quality and clearness and I learned a lot from you, serious. But I dare me a light nitpick: probably syntaxes is not your element ;) Mikhail

On 11/18/2016 11:19 AM, Mikhail V wrote:
On 18 November 2016 at 01:26, Steven D'Aprano wrote:
I'm not seeing D'Aprano's posts, except in Mikhail's replies -- Mikhail, is he replying directly to you? If so, please stop including Python Ideas in your replies. Thank you. -- ~Ethan~

On Fri, Nov 18, 2016 at 11:31:21AM -0800, Ethan Furman wrote:
I'm not replying off-list, but something has clearly gone wrong with the mailing list. (I'm BCC'ing the list owners.) My earlier post (the one Mikhail has replied to) shows up in the ActiveState archive: http://code.activestate.com/lists/python-ideas/43270/ but not in the official python-list archive: https://mail.python.org/pipermail/python-ideas/2016-November/thread.html Later I see a reply from Ethan to a question posed by Chris Angelico http://code.activestate.com/lists/python-ideas/43276/ but I never received Chris' question. Neither Chris' question nor Ethan's response show up in the pipermail archive. -- Steve

On Sat, Nov 19, 2016 at 10:13 AM, Steven D'Aprano <steve@pearwood.info> wrote:
Part of that is because I actually responded off-list (though I don't mind that it went back on-list). However, Ethan's response should have gone to the list and the archive. ChrisA

On Nov 18 2016, Ethan Furman <ethan-gcWI5d7PMXnvaiG9KC9N7Q@public.gmane.org> wrote:
FWIW, I can see them on Gmane. Best, -Nikolaus -- GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F »Time flies like an arrow, fruit flies like a Banana.«
participants (5)
-
Chris Angelico
-
Ethan Furman
-
Mikhail V
-
Nikolaus Rath
-
Steven D'Aprano