Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in utility function to combine datamaps #9

Open
bmritz opened this issue Aug 31, 2022 · 2 comments
Open

Add in utility function to combine datamaps #9

bmritz opened this issue Aug 31, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@bmritz
Copy link
Owner

bmritz commented Aug 31, 2022

Thin wrapper perhaps around a dict concatenation.
Check for address conflicts and raise errors if they exist.

@bmritz bmritz added the enhancement New feature or request label Aug 31, 2022
@bmritz
Copy link
Owner Author

bmritz commented Sep 14, 2022

@bmritz
Copy link
Owner Author

bmritz commented Apr 6, 2023

def dict_concat(*args):
first = copy.copy(args[0])
assert isinstance(first, dict)
try:
rest = args[1:]
except IndexError:
return first
for d in rest:
assert isinstance(d, dict)
assert len(set(d).intersection(first)) == 0
first.update(d)
return first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant