title: Why is the dict not mutated in dask?
body: <p><a href="https://stackoverflow.com/questions/48650190/how-does-dask-delayed-handle-mutable-inputs/">How does dask.delayed handle mutable inputs?</a> explains it with <code>delayed</code> but what should I do if I need the input to be mutated?</p>
  <p>I have been trying out Dask and I need to understand how dictionaries are mutated when they are called using <code>distributed.Client.get</code> vs sequentially (normal way).</p>
  <p><strong>Sequential</strong></p>
  <pre><code>def foo(dictionary):
      dictionary['foo'] = 'foo was called'
  
  def bar(dictionary):
      dictionary['bar'] = 'bar was called'
  
  dictionary = {}
  
  print(dictionary) # {}
  foo(dictionary)
  print(dictionary) # {'foo': 'foo was called'}
  bar(dictionary)
  print(dictionary) # {'foo': 'foo was called', 'bar': 'bar was called'}
  </code></pre>
  <p>This works the way I expect it to, the dictionary is mutated and I get two keys after the calls to <code>foo</code> and <code>bar</code>.</p>
  <p><strong>Dask</strong></p>
  <pre><code>from dask.distributed import Client
  
  client = Client(processes=False)
  
  def foo(dictionary):
      dictionary['foo'] = 'foo was called'
  
  def bar(dictionary):
      dictionary['bar'] = 'bar was called'
  
  dictionary = {}
  
  dsk = {'foo': (foo, dictionary), 'bar':(bar, dictionary)}
  
  client.get(dsk, ['foo', 'bar'])
  
  print(dictionary) # {}
  </code></pre>
  <p>Why is this returning an empty dict? Why is that not mutated? I noticed the <code>dictionary</code> dict has different <code>id(dictionary)</code> inside each functions, so I understand it is a copy.</p>
  <p>Is it safe to assume that every function gets its own copy of the objects passed to it? So I can mutate them within the function and have the one at global untouched? Is this understanding correct?</p>