News for hackers. Stuff that matters.
Re:What’s New in Python 3.8 by peterwwillis on Monday October 14, 2019 @07:04PM (#21253808)
Perl devs have been using the walrus expression for decades, but we just called it "assigning a variable with local scope in an expression".

  $ perl
    $a = "foo";
    if ( my $a = "bar" ) { print "$a\n" }
    print "$a\n"
  bar
  foo
Re:What’s New in Python 3.8 by takeda on Monday October 14, 2019 @07:36PM (#21254042)
The reason why assignment expressions initially were not allowed in Python and why they had to introduce "walrus" was because in languages that used single equal sign for assignment enable to easily make bugs by typing "=" instead of "==".
Re:What’s New in Python 3.8 by jaynetics on Tuesday October 15, 2019 @03:28AM (#21256296)
I find it strange to sacrifice syntactical simplicity for bug prevention in a language that needs deep testing anyway because it's neither nil- nor type-safe. But maybe I'm just to used to inline "=".
Re:What’s New in Python 3.8 by pyrale on Tuesday October 15, 2019 @04:13AM (#21256484)
A partial solution was already introduced with `with x as y`.
Re:What’s New in Python 3.8 by geofft on Monday October 14, 2019 @07:34PM (#21254029)
Yup, C and many other languages also have it:

    if (ptr = strchr(address, ':'))
        port = atoi(ptr + 1);
Re:What’s New in Python 3.8 by iso-8859-1 on Monday October 14, 2019 @11:50PM (#21255393)
It doesn't do scoping, so not really the same.
Re:What’s New in Python 3.8 by gpderetta on Tuesday October 15, 2019 @06:06AM (#21257037)
it can in C++ (when specifying auto or a type). I thought it did in C as well, but apparently not.