title: Go language simultaneous assignment through un-buffered channel: how does it work?
body: <p>I'm learning Go and saw this program at <a href="http://go.dev/tour/concurrency/2" rel="nofollow noreferrer">go.dev/tour/concurrency/2</a></p>
  <pre><code>package main
  
  import &quot;fmt&quot;
  
  func sum(s []int, c chan int) {
      sum := 0
      for _, v := range s {
          sum += v
      }
      c &lt;- sum // send sum to c
  }
  
  func main() {
      s := []int{7, 2, 8, -9, 4, 0}
  
      c := make(chan int)
      go sum(s[:len(s)/2], c)
      go sum(s[len(s)/2:], c)
      x, y := &lt;-c, &lt;-c // receive from c
  
      fmt.Println(x, y, x+y)
  }
  </code></pre>
  <p>I recall that in python the execution flow of <code>a, b = b, a</code> should be like:</p>
  <blockquote>
  <ol>
  <li>Create a temporary tuple of (b, a)</li>
  </ol>
  </blockquote>
  <blockquote>
  <ol start="2">
  <li>Assign each value in (b, a) to variables in (a, b) with a loop</li>
  </ol>
  </blockquote>
  <p>The method doesn't seem to apply to this occasion in GO. So what actually happens in that <code>a, b = b, a</code> sentence?</p>