Every Release Can Be a Mini "Python 4000", Within Reason (was (name := expression) doesn't fit the narrative of PEP 20)
On Thu, Apr 26, 2018 at 12:52 AM, Greg Ewing
[snip] here we would be *creating* one (two different assignment operators with overlapping use cases) that we won't be able to get rid of without a Python 4000 (that Guido has promised won't happen).
The edict about "Python 4000" is more about not repeating what happened with Python 3 than strictly prohibiting breaking backward compatibility. [1] The way I understand it, the problem with Py3k was that so many things changed in a backward-incompatible way. Folks could have coped with the unicode change as the big one for Python 2.7 (or 2.8 or 3.0 or whatever it ended up being). However, so many other things changed all at once that the burden to move to Python 3 became daunting. This included a number of back-compat-breaking syntax changes. Unless I've missed something, there's no prohibition against deprecating things (and then later removing them) or other breaks in backward compatibility. We certainly avoid it, with good reason. However, when we do break compatibility, the thing we want to avoid is introducing too many such changes all at once (and to keep in mind that such changes can add up to the same detriment when viewed in aggregate across multiple releases). That said, syntax is definitely a trickier target when it comes to breaking backward compatibility. So we have to be especially careful about adding it in the first place. I suppose that's a big part of the reason for the strong reaction to the "binding expressions" proposal. -eric [1] I'm hopeful we can consolidate a retrospective on Python 3 in a PEP: https://mail.python.org/pipermail/python-dev/2018-April/153131.html
Eric Snow wrote:
Unless I've missed something, there's no prohibition against deprecating things (and then later removing them) or other breaks in backward compatibility.
I suppose that's true, but even so, changing "=" is going to feel like a really big change in the style of the language, bigger even than making "print" no longer a statement. It seems like there should be more justification for it than "well, it became redundant with :=". How would you complete the following sentence? "The ':=' symbol is a much better symbol for assignment than '=', because..." -- Greg
On 27/04/2018 08:38, Greg Ewing wrote:
How would you complete the following sentence? "The ':=' symbol is a much better symbol for assignment than '=', because..."
... users new to programming but with a scientific background expect '=' to be a statement of an algebraic relationship between mathematical quantities, not an instruction to the machine to do something. That's easy to answer. (I can remember this particular light bulb moment in a fellow student, who had been using a different name in every assignment statement, and had found loops impossible to understand.) Also it frees up '=' to be used with something like its expected meaning in conditional statements, without making parsing hard/impossible. There are arguments the other way, like brevity and familiarity to other constituencies. But I feel we all know this. Having chosen to go the '=', '==' route, the cost is large to change, especially to get the other half of the benefit ('=' as a predicate). So I think the question might be who is it better for and how much do we care. And whether the days are gone when anyone learns algebra before programming. I speculate this all goes back to some pre-iteration version of FORmula TRANslation, where to its inventors '=' was definition and these really were "statements" in the normal sense of stating a truth. Jeff Allen
On 29 April 2018 at 01:34, Jeff Allen
On 27/04/2018 08:38, Greg Ewing wrote:
I speculate this all goes back to some pre-iteration version of FORmula TRANslation, where to its inventors '=' was definition and these really were "statements" in the normal sense of stating a truth.
https://www.hillelwayne.com/post/equals-as-assignment/ -- Eitan Adler
On Sunday, April 29, 2018, Eitan Adler
On 29 April 2018 at 01:34, Jeff Allen
wrote: On 27/04/2018 08:38, Greg Ewing wrote:
I speculate this all goes back to some pre-iteration version of FORmula TRANslation, where to its inventors '=' was definition and these really were "statements" in the normal sense of stating a truth.
https://en.wikipedia.org/wiki/Assignment_(computer_science) C and C++ are '=' and '=='. The Sympy solver, for example, solves Eq(lhs, rhs) equations and expressions that are assumed to be equal to zero. http://docs.sympy.org/latest/tutorial/solvers.html The sage solver defines __eq__ (==) so expressions with variables produce symbolic equations and inequalities (relations). http://doc.sagemath.org/html/en/reference/calculus/sage/symbolic/relation.ht... PyDatalog defines __eq__ so that expressions with variables produce logic queries. https://sites.google.com/site/pydatalog/Online-datalog-tutorial The assignment Wikipedia article lists languages other than C and C++ which chose = and == for assignment and definable equality testing. https://en.wikipedia.org/wiki/Equality_(mathematics) https://en.wikipedia.org/wiki/Extensionality https://en.wikipedia.org/wiki/Logical_equality
-- Eitan Adler _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/ wes.turner%40gmail.com
On Sun, Apr 29, 2018 at 10:45 AM, Eitan Adler
On 29 April 2018 at 01:34, Jeff Allen
wrote: On 27/04/2018 08:38, Greg Ewing wrote:
I speculate this all goes back to some pre-iteration version of FORmula TRANslation, where to its inventors '=' was definition and these really were "statements" in the normal sense of stating a truth.
That blog post was brought up before in this discussion (probably on python-ideas). I have my doubts about whether it accurately represents the historic truth though. -- --Guido van Rossum (python.org/~guido)
On 4/29/2018 11:51 PM, Guido van Rossum wrote:
On Sun, Apr 29, 2018 at 10:45 AM, Eitan Adler
mailto:lists@eitanadler.com> wrote: On 29 April 2018 at 01:34, Jeff Allen
mailto:ja.py@farowl.co.uk> wrote: > On 27/04/2018 08:38, Greg Ewing wrote: > I speculate this all goes back to some pre-iteration version of FORmula > TRANslation, where to its inventors '=' was definition and these really were > "statements" in the normal sense of stating a truth.
https://www.hillelwayne.com/post/equals-as-assignment/ https://www.hillelwayne.com/post/equals-as-assignment/
That blog post was brought up before in this discussion (probably on python-ideas). I have my doubts about whether it accurately represents the historic truth though.
It is woefully incomplete in omitting the common usage of = to mean 'equals' both as statement (comparison) and command (assignment) in both English and math. I don't have any math books that I know of that predate computers, but I suspect the usage is not new. The pre-C computer language history has a gaping hole: BASIC, which uses = for both assignment and comparison, was released May 1, 1964. I don't believe the syntax allowed any ambiguity as to the meaning of each occurrence. To me, it is the use of anything else that needs explaining. -- Terry Jan Reedy
Jeff Allen wrote:
I speculate this all goes back to some pre-iteration version of FORmula TRANslation, where to its inventors '=' was definition and these really were "statements" in the normal sense of stating a truth.
Yeah, also the earliest FORTRAN didn't even *have* comparison operators. A conditional branch was something like IF (X-Y) 10, 20, 30 going three different ways depending on whether X-Y was negative, zero or positive. Then when comparison operators were added, a lot of people didn't have "<" and ">" characters available to them, so FORTRAN used ".EQ.", ".LT.", ".GT." etc. instead. We're actually quite spoiled with our "==" operator! -- Greg
On 30/04/2018 07:22, Greg Ewing wrote:
Jeff Allen wrote:
I speculate this all goes back to some pre-iteration version of FORmula TRANslation, where to its inventors '=' was definition and these really were "statements" in the normal sense of stating a truth.
Yeah, also the earliest FORTRAN didn't even *have* comparison operators. A conditional branch was something like
I should have known that would turn out to be the most interesting part in my message. Not to take us further off topic, I'll just say thanks to Eitan's reply, I found this: http://www.softwarepreservation.org/projects/FORTRAN/BackusEtAl-Preliminary%... They were not "statements", but "formulas" while '=' was assignment (sec 8) *and* comparison (sec 10B). So conversely to our worry, they actually wanted users to think of assignment initially as a mathematical formula (page 2) in order to exploit the similarity to a familiar concept, albeit a=a+i makes no sense from this perspective. Jeff Allen
On 4/30/2018 4:00 PM, Jeff Allen wrote:
They were not "statements", but "formulas" while '=' was assignment (sec 8) *and* comparison (sec 10B). So conversely to our worry, they actually wanted users to think of assignment initially as a mathematical formula (page 2) in order to exploit the similarity to a familiar concept, albeit a=a+i makes no sense from this perspective.
When explaining iterative algorithms, such as Newton's method, mathematicians write things like a' = a+1 or a(sub i+1 or sub new) = f(a(sub i or sub old)) . For computer, we drop the super/subscript. Or one can write more circuitously, anew = update(aold) aold = anew The abbreviations should be explained when teaching loops. For proving that the body of a loop maintains a loop constant, one may reinstate the super- or sub-script. -- Terry Jan Reedy
FWIW, this thread is about what "Python 4000" means and does not mean.
Namely, Python feature deprecation and removal is not prohibited but
the bar is high (as always), especially for syntax. While I
appreciate the level of interest in certain under-consideration
proposals, you'd be better served by continuing discussion about that
proposal in other threads. Thanks!
-eric
On Mon, Apr 30, 2018 at 7:25 PM, Terry Reedy
On 4/30/2018 4:00 PM, Jeff Allen wrote:
They were not "statements", but "formulas" while '=' was assignment (sec 8) *and* comparison (sec 10B). So conversely to our worry, they actually wanted users to think of assignment initially as a mathematical formula (page 2) in order to exploit the similarity to a familiar concept, albeit a=a+i makes no sense from this perspective.
When explaining iterative algorithms, such as Newton's method, mathematicians write things like a' = a+1 or a(sub i+1 or sub new) = f(a(sub i or sub old)) . For computer, we drop the super/subscript. Or one can write more circuitously, anew = update(aold) aold = anew The abbreviations should be explained when teaching loops.
For proving that the body of a loop maintains a loop constant, one may reinstate the super- or sub-script.
-- Terry Jan Reedy
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/ericsnowcurrently%40gmail...
participants (7)
-
Eitan Adler
-
Eric Snow
-
Greg Ewing
-
Guido van Rossum
-
Jeff Allen
-
Terry Reedy
-
Wes Turner