comp.lang.ada
 help / color / mirror / Atom feed
* [Off-Topic] Python gets :=
@ 2018-07-20 21:56 Alejandro R. Mosteo
  2018-07-21  5:47 ` Nasser M. Abbasi
  0 siblings, 1 reply; 7+ messages in thread
From: Alejandro R. Mosteo @ 2018-07-20 21:56 UTC (permalink / raw)


PEP 572 has been accepted:
https://www.python.org/dev/peps/pep-0572/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Off-Topic] Python gets :=
  2018-07-20 21:56 [Off-Topic] Python gets := Alejandro R. Mosteo
@ 2018-07-21  5:47 ` Nasser M. Abbasi
  2018-07-21  7:50   ` Paul Rubin
  2018-07-21 10:31   ` Chris M Moore
  0 siblings, 2 replies; 7+ messages in thread
From: Nasser M. Abbasi @ 2018-07-21  5:47 UTC (permalink / raw)


On 07/20/2018 04:56 PM, Alejandro R. Mosteo wrote:
> PEP 572 has been accepted:
> https://www.python.org/dev/peps/pep-0572/
> 

I find it amazing that assignment has just been added
to a language created almost 30 years ago.

Was not a variable assignment something already
known in those dark ages back in 1989 when Python was
designed?

--Nasser





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Off-Topic] Python gets :=
  2018-07-21  5:47 ` Nasser M. Abbasi
@ 2018-07-21  7:50   ` Paul Rubin
  2018-07-21  8:37     ` G.B.
  2018-07-21 10:31   ` Chris M Moore
  1 sibling, 1 reply; 7+ messages in thread
From: Paul Rubin @ 2018-07-21  7:50 UTC (permalink / raw)


"Nasser M. Abbasi" <nma@12000.org> writes:
> Was not a variable assignment something already known in those dark
> ages back in 1989 when Python was designed?

Python has had assignment statements like "a = 5" from the beginning.

The thing they just added was assignments inside expressions, like in C:

   if (m := re.match('foo(.*)bar', thing)):
      blecch(m)

i.e. if the regexp matches, save the match data in the variable m and
pass it to blecch on the next line.

I don't think Ada has that feature.  It's not something to fight wars
about, but I do find it useful sometimes in both C and Python.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Off-Topic] Python gets :=
  2018-07-21  7:50   ` Paul Rubin
@ 2018-07-21  8:37     ` G.B.
  0 siblings, 0 replies; 7+ messages in thread
From: G.B. @ 2018-07-21  8:37 UTC (permalink / raw)


On 21.07.18 09:50, Paul Rubin wrote:
> "Nasser M. Abbasi" <nma@12000.org> writes:
>> Was not a variable assignment something already known in those dark
>> ages back in 1989 when Python was designed?

> I don't think Ada has that feature.  It's not something to fight wars
> about, but I do find it useful sometimes in both C and Python.

Also, GvR is known to have preferred simple existing solutions
even when that meant lack of certain features useful sometimes.
An example is "reduce": use a for loop instead.

However, putting more meaning on just one long line is currently
quite popular, and marketeable. Consider "for streams" of current
Java, e.g.. What if Java were to have a parallel loop instead?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Off-Topic] Python gets :=
  2018-07-21  5:47 ` Nasser M. Abbasi
  2018-07-21  7:50   ` Paul Rubin
@ 2018-07-21 10:31   ` Chris M Moore
  2018-07-21 15:03     ` Rene
  1 sibling, 1 reply; 7+ messages in thread
From: Chris M Moore @ 2018-07-21 10:31 UTC (permalink / raw)


On 21/07/2018 06:47, Nasser M. Abbasi wrote:
> On 07/20/2018 04:56 PM, Alejandro R. Mosteo wrote:
>> PEP 572 has been accepted:
>> https://www.python.org/dev/peps/pep-0572/
>>
> 
> I find it amazing that assignment has just been added
> to a language created almost 30 years ago.
> 
> Was not a variable assignment something already
> known in those dark ages back in 1989 when Python was
> designed?

It's assignment expression.  See 
https://lwn.net/SubscriberLink/759558/1a4832a1ea96539f/

Interesting from an Ada perspective only in that they chose :=

-- 
sig pending (since 1995)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Off-Topic] Python gets :=
  2018-07-21 10:31   ` Chris M Moore
@ 2018-07-21 15:03     ` Rene
  2018-07-21 16:34       ` Paul Rubin
  0 siblings, 1 reply; 7+ messages in thread
From: Rene @ 2018-07-21 15:03 UTC (permalink / raw)


Am 21.07.2018 um 12:31 schrieb Chris M Moore:
> On 21/07/2018 06:47, Nasser M. Abbasi wrote:
>> On 07/20/2018 04:56 PM, Alejandro R. Mosteo wrote:
>>> PEP 572 has been accepted:
>>> https://www.python.org/dev/peps/pep-0572/
>>>
>>
>> I find it amazing that assignment has just been added
>> to a language created almost 30 years ago.
>>
>> Was not a variable assignment something already
>> known in those dark ages back in 1989 when Python was
>> designed?
> 
> It's assignment expression.  See 
> https://lwn.net/SubscriberLink/759558/1a4832a1ea96539f/
> 
> Interesting from an Ada perspective only in that they chose :=
> 

Using := is somewhat confusing as = is used for assignment expression in 
C-like languages, whereas Pascal-like languages (as Ada) don't have 
assignment expression and use := for assignment.

So it would more logical the other way round: = for assignment 
expression and := for assignment. But of course this is not possible 
because of backwards compatibility.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Off-Topic] Python gets :=
  2018-07-21 15:03     ` Rene
@ 2018-07-21 16:34       ` Paul Rubin
  0 siblings, 0 replies; 7+ messages in thread
From: Paul Rubin @ 2018-07-21 16:34 UTC (permalink / raw)


Rene <rehartmann@t-online.de> writes:
> So it would more logical the other way round: = for assignment
> expression and := for assignment. But of course this is not possible
> because of backwards compatibility.

In principle it's fine to use the same symbol for both.  GvR picked =
for assignment, and then didn't want to use it for assignment
expressions because of the possible bug where someone says "if a=b"
(assignment) when they meant "if a==b" (comparison).  So he decided to
not have assignment expressions at all.  That lack was a source of 20
years of conflict in the Python community.  Finally he accepted the :=
proposal and that set off enough conflict in its own right, that he
stepped down as BDFL (leader) of Python.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-07-21 16:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-20 21:56 [Off-Topic] Python gets := Alejandro R. Mosteo
2018-07-21  5:47 ` Nasser M. Abbasi
2018-07-21  7:50   ` Paul Rubin
2018-07-21  8:37     ` G.B.
2018-07-21 10:31   ` Chris M Moore
2018-07-21 15:03     ` Rene
2018-07-21 16:34       ` Paul Rubin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox