Hello Guido, On Thu, 26 Nov 2020 14:18:20 -0800 Guido van Rossum <guido@python.org> wrote:
On Thu, Nov 26, 2020 at 3:11 AM Paul Sokolovsky <pmiscml@gmail.com> wrote:
[...]
Hi Paul,
I think there is a case to be made for adding "let" to Python. Would you like to write a PEP? I recommend that you find a co-author who can help you write a convincing motivation to sway the Steering Council (not me).
Thanks for encouragement, but process-wise, I think it would be rejected just because it's written by me ;-). So, I'd prefer it were written by somebody else. That said, even rejected or permanently deferred PEPs still have their value, so I'll keep that in mind, for a case that nobody beats me on it.
(Why do I propose "let" and not "const"? It seems "let" has become the industry standard language. The other day I saw a reference to a LET() function in Excel. :-)
Note that many functional languages conflate the matter of introducing new variable binding (which are lexically nested per the computation theory best practices) and immutability. For an imperative language like Python we shouldn't fall into that trap. If anything, the mental model for "let" should be ol' good BASIC, where "LET", well, introduces a variable (well, it's semantically null, the point that there's no "immutability" connotation). JavaScript now has both "let" and "const", and I think there's a good case to have both in Python too. (As a disclaimer, I'm not a JavaScript user, nor avid JavaScript spec reader. I do the latter strictly on demand, "to not pick up bad ideas". And I'm currently at the stage of intuitive contemplation of why both "let" and "const" may be useful for languages like JavaScript and Python, and only then going to compare my intuition with what's actually implemented in JavaScript. Of course, doing this and many other homeworks are prerequisites for writing the PEP.) -- Best regards, Paul mailto:pmiscml@gmail.com