On Sat, Apr 14, 2018 at 12:36 AM, Nick Coghlan <ncogh...@gmail.com> wrote: > On 13 April 2018 at 22:35, Chris Angelico <ros...@gmail.com> wrote: >> On Fri, Apr 13, 2018 at 10:22 PM, Steven D'Aprano <st...@pearwood.info> >> wrote: >>> On Wed, Apr 11, 2018 at 11:50:44PM +1000, Chris Angelico wrote: >>> >>>> > Previously, there was an alternative _operator form_ `->` proposed by >>>> > Steven D'Aprano. This option is no longer considered? I see several >>>> > advantages with this variant: >>>> > 1. It does not use `:` symbol which is very visually overloaded in >>>> > Python. >>>> > 2. It is clearly distinguishable from the usual assignment statement and >>>> > it's `+=` friends >>>> > There are others but they are minor. >>>> >>>> I'm not sure why you posted this in response to the open question, but >>>> whatever. The arrow operator is already a token in Python (due to its >>>> use in 'def' statements) and should not conflict with anything; >>>> however, apart from "it looks different", it doesn't have much to >>>> speak for it. >>> >>> On the contrary, it puts the expression first, where it belongs >>> *semi-wink*. >> >> The 'as' syntax already has that going for it. What's the advantage of >> the arrow over the two front-runners, ':=' and 'as'? > > I stumbled across > https://www.hillelwayne.com/post/equals-as-assignment/ earlier this > week, and I think it provides grounds to reconsider the suitability of > ":=", as that symbol has historically referred to *re*binding an > already declared name. That isn't the way we're proposing to use it > here: we're using it to mean both implicit local variable declaration > *and* rebinding of an existing name, the same as we do for "=" and > "as".
I'm not bothered by that. Assignment semantics vary from one language to another; the fact that Python marks as local anything that's assigned to is independent of the way you assign to it. ("print(x)" followed by "for x in ..." is going to bomb with UnboundLocalError, for instance.) If Python had any form of local variable declarations, it wouldn't change the behaviour of the := operator. ChrisA _______________________________________________ Python-ideas mailing list Pythonemail@example.com https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/