title: This use of python ternary operator fails - not sure why?
body: <p>In my function, if a dictionary exists (passed in as a parameter) then add another dictionary to it, or else use it as the dictionary.  (here context is the relevant dictionary)    </p>
  
  <pre><code>def some_view(request, form_class, template, success_url, context=None):
      ..........
      if context is not None:
          context.update({'form': form})
      else:
          context = {'form': form}
      return render(request, template, context)
  </code></pre>
  
  <p>This works fine but using </p>
  
  <pre><code>context = context.update({'form': form}) if context is not None else {'form': form}
  </code></pre>
  
  <p>fails for some reason as context is return as None?</p>