I've been a python dev for more than two years and somehow I didn't know that dicts can be updated by kwargs. Like this:
>>> a = {'a': 1}
>>> a.update(b=5)
>>> a
{'a': 1, 'b': 5}
So obvious, yet.
I've been a python dev for more than two years and somehow I didn't know that dicts can be updated by kwargs. Like this:
>>> a = {'a': 1}
>>> a.update(b=5)
>>> a
{'a': 1, 'b': 5}
So obvious, yet.
For further actions, you may consider blocking this person and/or reporting abuse
Max Shapira -
@lukeocodes 🕹👨💻 -
MAMAsoon -
Yawar Amin -
Once suspended, mxl will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, mxl will be able to comment and publish posts again.
Once unpublished, all posts by mxl will become hidden and only accessible to themselves.
If mxl is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to Maria Boldyreva.
They can still re-publish the post if they are not suspended.
Thanks for keeping DEV Community safe. Here is what you can do to flag mxl:
Unflagging mxl will restore default visibility to their posts.
Top comments (3)
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+:
this way you can merge dictionary a with b (or an in-line dict). c is the result, a and b remain unchanged.
Thanks Rhymes!
I learned it thanks to Django and csrf token :)
dictionary = dict(request=request, message=message)
dictionary.update(csrf(request))
regards :)