How to use 'python dictionary extend' in Python

Every line of 'python dictionary extend' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
29def extend(d, base):
30 return dict(d, **base)

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

75def update(self, d):
76 for key in d.keys():
77 # Ignore invalid keys, rather than raising an exception.
78 try:
79 skey = str(key)
80 except:
81 continue
82 if skey==key and not skey.startswith('_'):
83 self.__dict__[skey] = d[key]

Related snippets