Last active
September 26, 2017 15:03
-
-
Save asher-pembroke/01a8dc2844f6a7738ebddf2da18f18fc to your computer and use it in GitHub Desktop.
Merge two named tuples in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def merge_tuples(a,b, name = 'Name'): | |
| """Returns a join of two named tuples | |
| Duplicate names will raise an error. | |
| """ | |
| return namedtuple(name, a._fields + b._fields)(*(a+b)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment