Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
On 07/12/2018 03:03 PM, Abdur-Rahmaan Janhangeer wrote: btw smileys in this thread should have been :=) lol! -- ~Ethan~ ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
ok then was a point i wanted to clear btw smileys in this thread should have been :=) Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
*D in BDFL stands for Dictator. * The B diminishes that ex sugar not same as salty sugar Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ > > ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
On Thu, Jul 12, 2018 at 6:21 PM, Barry Warsaw wrote: > [...] > > I was -1 as well, but I’d say I’m a firm +0 now[*]. I like how many of > the problematic syntactic and semantic issues have been narrowed and > prohibited, and I can see myself using this sparingly. > [...] I think experience will show that's how it's best used - only for measurable wins. But then Python is the kind of language where "if it's simpler, use that" is a part of the philosophy, thanks to the Zen's popularity. ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
On Thu, Jul 12, 2018, 1:24 PM Barry Warsaw wrote: > It’s not the first time I’ve found myself in this position with a new > Python feature, and it’s one of the reasons I deeply trust Guido’s > intuition and sensibilities. > Sure... Except for the terrible choice to drop the '<>' inequality operator, and why all my scripts start with barry_as_FLUFL. :-) > ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
On Jul 12, 2018, at 09:23, INADA Naoki wrote: >> >> Yes, the PEP has improved significantly since that time. My guess is the >> same poll taken now could give an opposite result. >> > > I still -0 on PEP 572. But strong -1 on restart discussion about changing it. > We should polish and implement it for now, not change. I think that’s likely true. While extremely painful for so many of us, I think the end result is a much better PEP, and a much better feature. I was -1 as well, but I’d say I’m a firm +0 now[*]. I like how many of the problematic syntactic and semantic issues have been narrowed and prohibited, and I can see myself using this sparingly. It’s not the first time I’ve found myself in this position with a new Python feature, and it’s one of the reasons I deeply trust Guido’s intuition and sensibilities. Cheers, -Barry [*] Not that it matters; the PEP is accepted - time to move on! The world won’t end. :) signature.asc Description: Message signed with OpenPGP ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
On Fri, Jul 13, 2018 at 12:48 AM Ivan Levkivskyi wrote: > > On 12 July 2018 at 16:41, Victor Stinner wrote: >> >> 2018-07-12 17:14 GMT+02:00 Abdur-Rahmaan Janhangeer : >> > sorry for reviving the dead but community acceptance, a fundamental pep >> > principle has not been respected for 572 >> > >> > also 29 core devs dislike vs 3 like >> >> [...] *as the PEP evolved* in the meanwhile. > > > Yes, the PEP has improved significantly since that time. My guess is the same > poll taken now could give an opposite result. > I still -0 on PEP 572. But strong -1 on restart discussion about changing it. We should polish and implement it for now, not change. -- INADA Naoki ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
On 12 July 2018 at 16:41, Victor Stinner wrote: > 2018-07-12 17:14 GMT+02:00 Abdur-Rahmaan Janhangeer >: > > sorry for reviving the dead but community acceptance, a fundamental pep > > principle has not been respected for 572 > > > > also 29 core devs dislike vs 3 like > > [...] *as the PEP evolved* in the meanwhile. Yes, the PEP has improved significantly since that time. My guess is the same poll taken now could give an opposite result. -- Ivan ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
2018-07-12 17:14 GMT+02:00 Abdur-Rahmaan Janhangeer : > sorry for reviving the dead but community acceptance, a fundamental pep > principle has not been respected for 572 > > also 29 core devs dislike vs 3 like You are referring to a *poll* that I ran in May. I don't see any community issue, the PEP process was always the same: Guido van Rossum takes the final decision. IMHO since the poll has be done, some core devs changed their mind, *as the PEP evolved* in the meanwhile. For example, I'm more on the +1 side now (I was on the strong -1 side when I ran the poll). Anyway, it no longer matters since the PEP has been approved. It's now time to celebrate! > maybe there are special cases where the BDFL can pin issues D in BDFL stands for Dictator. Guido has super power :-) I'm fine with that. Victor ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
sorry for reviving the dead but community acceptance, a fundamental pep principle has not been respected for 572 also 29 core devs dislike vs 3 like maybe there are special cases where the BDFL can pin issues also, maybe there are two aspects, one disliking := and one the actual expression assignment as for me i don't like the := symbol Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ > > ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
On Thu, Jul 5, 2018 at 9:02 PM Alexander Belopolsky wrote: > What happened to the "consenting adults" philosophy? Just anecdotally, I've run into a number of professionals recently who've come out of Java environments who really dislike the "consenting adults" approach. While they value much that Python offers them, they still really want some of the hand-holding languages like Java give them. What exactly they identify as "compelling" varies based on their past experiences, but it's not completely without reason. The reasoning is often tied to providing APIs "less-experienced" programmers can use without breaking things. Some of these programmers at least claim to understand that bigger risks come from not dealing with API boundaries that check input values carefully, or that don't deal cleanly with exception propagation; that seems to be fairly difficult for many. The idiomatic models I've found most desirable in Python are not as widely valued as I'd hope. It's hard to say what that tells us, and I think we'd want more quantifiable evidence before drawing conclusions. The prevalence of expectation that an API constrains the mechanics of how it is used is something I find surprising. While I can suspect that it's misguided, I keep running into situations where code needs to be maintained by people who just aren't as familiar with the idioms I'm accustomed to, so... considering the issue has value. -Fred -- Fred L. Drake, Jr. "A storm broke loose in my mind." --Albert Einstein ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
On Thu, Jul 5, 2018, 7:46 PM Alexander Belopolsky < alexander.belopol...@gmail.com> wrote: > It also appears that there are no cases where = can be substituted for := > and not cause a syntax error. This means that ":" in ":=" is strictly > redundant. > Under your proposal, this is ambiguous: 'myfun(foo=5, bar=7)' ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
[Tim] > It doesn't even exist yet, but Googling on > python operator := > > already returns a directly relevant hit on the first page for me: > > > https://stackoverflow.com/questions/26000198/what-does-colon-equal-in-python-mean > ... > [Guido, who later apologized for unclear quoting, hilariously trying to pin the blame on GMail ;-)] Since they moved to the "new" GMail, quoting selected pieces in replies has become a nightmare for me too. I don't understand the options, and it seems there's no option at all to do "just plain text, please - nothing fancy" anymore :-( Since this thread is dead and everybody is just posting to get the last > word, > You're such a cynic. We're competing to get the _first_ word on something destined to convince you that PEP 572 can be vastly improved via a one-character change ;-) > I can report that for me, Googling for "Python :=" gives PEP 572 as the > first non-ad hit. Also among the top hits are section 6 (Expressions) and > section 7 (Simple statements) of the Python 3.7.0 docs. > And I get essentially the same Google results too when I leave out "operator" from my original To verify the obvious guess, Googling on just plain := does indeed return hits supremely relevant to the colon-equal "symbol" regardless of context. Seems there is at least one thing that Google still does right. :-) I'm sure it will be improved out of existence soon enough ;-) > ... > ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
Sorry for messing up the quoting. I blame GMail. Only the text starting "Since this thread is dead" was mine. On Thu, Jul 5, 2018 at 8:20 PM Guido van Rossum wrote: > On Thu, Jul 5, 2018 at 7:12 PM Tim Peters wrote: > It doesn't even exist yet, but Googling on > > python operator := > > already returns a directly relevant hit on the first page for me: > > > https://stackoverflow.com/questions/26000198/what-does-colon-equal-in-python-mean > > The hits above it are all to overviews of Python operators. Here on > Windows, the interface to the Python doc files in IDLE contains an entry > for each operator, so just typing := in the index search box will > eventually go directly to its docs. If you can't do something similar on > Linux, upgrade to Windows ;-) > > Since this thread is dead and everybody is just posting to get the last > word, I can report that for me, Googling for "Python :=" gives PEP 572 as > the first non-ad hit. Also among the top hits are section 6 (Expressions) > and section 7 (Simple statements) of the Python 3.7.0 docs. Seems there is > at least one thing that Google still does right. :-) > > (Though Bing also has an ironically relevant hit: apart from the above > StackOverflow issue, it found a piece of third party documentation titled > Conditionals and loops. :-) > > -- > --Guido van Rossum (python.org/~guido) > -- --Guido van Rossum (python.org/~guido) ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
On Thu, Jul 5, 2018 at 7:12 PM Tim Peters wrote: It doesn't even exist yet, but Googling on python operator := already returns a directly relevant hit on the first page for me: https://stackoverflow.com/questions/26000198/what-does-colon-equal-in-python-mean The hits above it are all to overviews of Python operators. Here on Windows, the interface to the Python doc files in IDLE contains an entry for each operator, so just typing := in the index search box will eventually go directly to its docs. If you can't do something similar on Linux, upgrade to Windows ;-) Since this thread is dead and everybody is just posting to get the last word, I can report that for me, Googling for "Python :=" gives PEP 572 as the first non-ad hit. Also among the top hits are section 6 (Expressions) and section 7 (Simple statements) of the Python 3.7.0 docs. Seems there is at least one thing that Google still does right. :-) (Though Bing also has an ironically relevant hit: apart from the above StackOverflow issue, it found a piece of third party documentation titled Conditionals and loops. :-) -- --Guido van Rossum (python.org/~guido) ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
[Alexander Belopolsky] > > Do we want to protect users who > > cannot tell = from == so much that we are willing to cause Python to be > > the first language with two non-interchangeable assignment operators? > [Steven D'Aprano][ Not even close to the first. Go beat us to it -- it has both = and := > assignment operators. > > Ocaml also has := for regular assignment and <- for assignment to > mutable fields. > > Similarly, Haskall has = for assignment definitions and <- for binding > in monads. > I skipped that part, because nobody actually cares ;-) But back when I looked at this, R had them all beat, and I never found a single source that actually managed to list _all_ of R's variations This source was clearest, but is missing (at least) all the ways to spell all the variations as function calls too: https://stat.ethz.ch/R-manual/R-devel/library/base/html/assignOps.html There are three different assignment operators: two of them have leftwards > and rightwards forms. > The operators <- and = assign into the environment in which they are > evaluated. The operator <- can be used anywhere, whereas the operator = is > only allowed at the top level (e.g., in the complete expression typed at > the command prompt) or as one of the subexpressions in a braced list of > expressions. > The operators <<- and ->> are normally only used in functions, and cause a > ... > .[click the link if you're still awake] > ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
On Thu, Jul 5, 2018 at 10:10 PM Tim Peters wrote: > .. > I solved the problem in my own code by using an editor that displays a > single "=" in C source as a left-arrow graphic (that's one of its > C-specific display options - again a response to how notorious this > bug-magnet is). So assignment and equality-testing in C code look > entirely different to me, regardless of context. > > But to this day, I routinely get a SyntaxError when writing new Python > code because I _think_ "if x equals y" and _type_ "if x = y:". So I know > for sure that it's still a typo I'm way too prone to make. > Python really has a strong C legacy and this is the area where I agree that C designers made a mistake by picking a symmetric symbol (=) for an asymmetric operation. On top of that, they picked an asymmetric digraph (!=) for a symmetric operation as well and Python (unfortunately) followed the crowd and ditched a much better alternative (<>). My only hope is that Python 4.0 will allow ← to be used in place of either = or :=. :-) ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
On Thu, Jul 05, 2018 at 09:00:39PM -0400, Alexander Belopolsky wrote: > Do we want to protect users who > cannot tell = from == so much that we are willing to cause Python to be > the first language with two non-interchangeable assignment operators? Not even close to the first. Go beat us to it -- it has both = and := assignment operators. Ocaml also has := for regular assignment and <- for assignment to mutable fields. Similarly, Haskall has = for assignment definitions and <- for binding in monads. -- Steve ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
[Alexander Belopolsky] >>> ... >>> I also think that the dreadfulness of mistyping = where == is expected >>> is exaggerated. [Tim] >> There are a number of core devs who would be rabidly opposed >> to allowing that confusion in Python, due to still-remembered >> real-life nightmares in C. For example, me ;-) It only takes one >> wasted day of debugging that typo in a time-critical project to sour >> you on it for life, and several of us run out of fingers counting the >> number of days it actually did cost over our C careers. [Alexander] > I still do quite a bit of C programming and I have exactly the opposite > experience Meaning that confusing "=" and "==" in C _saves_ you days of debugging in time-critical projects? ;-) > given modern environments: why is gcc/clang/vs complaining about if (x=a) - > I know what I am doing! Because gcc/clang/vs is acknowledging how widely and deeply this C wart is despised. Isn't that obvious? You're quite the exception here, not "the rule" - as gcc/clang/vs eternally but apparently futilely remind you ;-) ... > Seriously, ':=' looks like a reluctantly introduced kludge to allow > assignment in expressions. There have been piles of other suggestions, but ":=" remains the least disliked (at least by Guido, and his opinion actually counts ;-) ). > We agree that it is sometimes useful to have, but we will make the feature > really hard to use ? It's very easy to use. Try it - I have. But I've used several languages in which ":=" was _the_ way to spell assignment, so it felt familiar at first touch. > or discover. It doesn't even exist yet, but Googling on python operator := already returns a directly relevant hit on the first page for me: https://stackoverflow.com/questions/26000198/what-does-colon-equal-in-python-mean The hits above it are all to overviews of Python operators. Here on Windows, the interface to the Python doc files in IDLE contains an entry for each operator, so just typing := in the index search box will eventually go directly to its docs. If you can't do something similar on Linux, upgrade to Windows ;-) > What happened to the "consenting adults" philosophy? Struggling mightily the last several months to get consensus on some form of embedded assignment _at all_ :-( > Do we want to protect users who cannot tell = from == Yes. > so much that we are willing to cause Python to be the first language > with two non-interchangeable assignment operators? Sure - I am. _Far_ more than I'm willing to reproduce C's mistake. It's one of the first things singled out in Andrew Koenig's "C Traps and Pitfalls", starting with his original paper that was the basis for his 1989 book of the same name: http://literateprogramming.com/ctraps.pdf You can use Google too - it's a top-10 item in every list of "C warts" I've ever seen. It's impossible to overstate how hated it is. But, sure - if you post in its defense a few more times, everyone sensible is sure to change their mind - and I'll ask Andrew to remove that section from his still-selling book ;-) I solved the problem in my own code by using an editor that displays a single "=" in C source as a left-arrow graphic (that's one of its C-specific display options - again a response to how notorious this bug-magnet is). So assignment and equality-testing in C code look entirely different to me, regardless of context. But to this day, I routinely get a SyntaxError when writing new Python code because I _think_ "if x equals y" and _type_ "if x = y:". So I know for sure that it's still a typo I'm way too prone to make. I've picked up that you're not, but that's scant comfort ;-) ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
On Thu, Jul 5, 2018 at 8:28 PM Tim Peters wrote: > [Alexander Belopolsky] > > ... > > I also think that the dreadfulness of mistyping = where == is expected > > is exaggerated. > > There are a number of core devs who would be rabidly opposed to allowing > that confusion in Python, due to still-remembered real-life nightmares in > C. For example, me ;-) It only takes one wasted day of debugging that > typo in a time-critical project to sour you on it for life, and several of > us run out of fingers counting the number of days it actually did cost over > our C careers. > I still do quite a bit of C programming and I have exactly the opposite experience given modern environments: why is gcc/clang/vs complaining about if (x=a) - I know what I am doing! No, I don't want to put two pairs of (..) around condition - one is one too many! > Alas, many people new to Python put parens around _all_ `if` and `while` > conditions, due to habit carried over from other languages (common as > newbies on, e.g., StackOverflow). They're the most vulnerable. Nobody in > their right mind even suspects that putting parens around an entire > expression could have semantic significance. > > a = 1 + 2 # OK, adds 1 and 2 > a = (1 + 2) # but who could possibly guess what this means? ;-) > > But I expect the idea was DOA for the first reason above. > Not that unlike Yuri, I don't think the language should require (..) around assignment expressions. Seriously, ':=' looks like a reluctantly introduced kludge to allow assignment in expressions. We agree that it is sometimes useful to have, but we will make the feature really hard to use or discover. What happened to the "consenting adults" philosophy? Do we want to protect users who cannot tell = from == so much that we are willing to cause Python to be the first language with two non-interchangeable assignment operators? ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
[Alexander Belopolsky] > ... > I also think that the dreadfulness of mistyping = where == is expected > is exaggerated. There are a number of core devs who would be rabidly opposed to allowing that confusion in Python, due to still-remembered real-life nightmares in C. For example, me ;-) It only takes one wasted day of debugging that typo in a time-critical project to sour you on it for life, and several of us run out of fingers counting the number of days it actually did cost over our C careers. > In all motivating cases, := is used to introduce new bindings rather than > rebinding existing names. I've heard people say that several times now, but suspect that's due to that they're looking at "motivating cases" in isolation. In a function, for example, doing a lot with regexps, blocks like if m := pat1.search(string): ... if m := pat2.search(substring): ... may be present any number of times. Only the first such block is _not_ a rebinding. Reusing short temp names for stuff like this may be almost as common as using `i` and `j` as for-loop target names. > Automated code checkers can easily warn users when they rebind > variables in if statements and suggest that they silence the warnings > with redundant (..) if they really want what they wrote. Alas, many people new to Python put parens around _all_ `if` and `while` conditions, due to habit carried over from other languages (common as newbies on, e.g., StackOverflow). They're the most vulnerable. Nobody in their right mind even suspects that putting parens around an entire expression could have semantic significance. a = 1 + 2 # OK, adds 1 and 2 a = (1 + 2) # but who could possibly guess what this means? ;-) But I expect the idea was DOA for the first reason above. ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
Sorry, I tried this too. If you think the response to the current version of the PEP is strong, the negative reaction to that version was way stronger, and I decided not to pursue it. On Thu, Jul 5, 2018 at 5:00 PM Alexander Belopolsky < alexander.belopol...@gmail.com> wrote: > > > On Thu, Jul 5, 2018 at 7:47 PM Yury Selivanov > wrote: > >> I think I tried a variation of your proposal here >> https://mail.python.org/pipermail/python-dev/2018-April/152939.html >> and nobody really liked it. >> >> Right. I now recall your proposal. I think I did not support it at the > time because I was against having expressions with side-effects regardless > of syntax. Now, as I mentioned, in the current form the PEP makes a strong > case for allowing a limited form of variable assignment in expressions. I > also think that the dreadfulness of mistyping = where == is expected is > exaggerated. In all motivating cases, := is used to introduce new bindings > rather than rebinding existing names. Automated code checkers can easily > warn users when they rebind variables in if statements and suggest that > they silence the warnings with redundant (..) if they really want what they > wrote. > > ___ > 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/guido%40python.org > -- --Guido van Rossum (python.org/~guido) ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
On Thu, Jul 5, 2018 at 7:47 PM Yury Selivanov wrote: > I think I tried a variation of your proposal here > https://mail.python.org/pipermail/python-dev/2018-April/152939.html > and nobody really liked it. > > Right. I now recall your proposal. I think I did not support it at the time because I was against having expressions with side-effects regardless of syntax. Now, as I mentioned, in the current form the PEP makes a strong case for allowing a limited form of variable assignment in expressions. I also think that the dreadfulness of mistyping = where == is expected is exaggerated. In all motivating cases, := is used to introduce new bindings rather than rebinding existing names. Automated code checkers can easily warn users when they rebind variables in if statements and suggest that they silence the warnings with redundant (..) if they really want what they wrote. ___ 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/archive%40mail-archive.com
Re: [Python-Dev] PEP 572: Do we really need a ":" in ":="?
I think I tried a variation of your proposal here https://mail.python.org/pipermail/python-dev/2018-April/152939.html and nobody really liked it. Yury On Thu, Jul 5, 2018 at 7:44 PM Alexander Belopolsky wrote: > > I wish I had more time to make my case, but with the PEP 572 pronouncement > imminent, let me make an attempt to save Python from having two assignment > operators. > > I've re-read the PEP, and honestly I am warming up to the idea of allowing a > limited form of assignment in expressions. It looks like in the current > form, the PEP supports only well-motivated cases where the return value of > the assignment expression is non-controversial. It also appears that there > are no cases where = can be substituted for := and not cause a syntax error. > This means that ":" in ":=" is strictly redundant. > > Interestingly, Python already has a precedent for using redundant ":" - the > line-ending ":" in various statements is redundant, but it is helpful both > when reading and writing the code. > > On the other hand, ':' in ':=' looks like an unnecessary embellishment. When > we use ':=', we already know that we are inside an expression and being > inside an expression is an obvious context for the reader, the writer and the > interpreter. > > I also believe, allowing a limited form of assignment in expressions is a > simpler story to tell to the existing users than an introduction of a new > operator that is somewhat like '=', but cannot be used where you currently > use '=' and only in places where '=' is currently prohibited. > > ___ > 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/yselivanov.ml%40gmail.com -- Yury ___ 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/archive%40mail-archive.com