Skip to content
loading...
markdown guide
 

The only drawback of this is that update does not return anything so you can't use it in an expression.

There's an alternative in Python 3.5+:

c = {**a, **b}

this way you can merge dictionary a with b (or an in-line dict). c is the result, a and b remain unchanged.

 
 

I learned it thanks to Django and csrf token :)

dictionary = dict(request=request, message=message)
dictionary.update(csrf(request))

regards :)

Classic DEV Post from Jul 10 '19

How is your portfolio built?

Maria Boldyreva profile image
A coder.
Did you know you can change your "experience level" in your DEV settings, so you can see content more tailored to your skills?
Join DEV Now