Last active
August 29, 2015 13:59
-
-
Save coilysiren/10691309 to your computer and use it in GitHub Desktop.
beacuse *args and **kwargs are too obscure
This file contains 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 unpack (collection): | |
'''unpack arguments from a collection (list or dictionary)''' | |
if type(collection) == list: | |
return *collection | |
if type(collection) == dict: | |
return **collection | |
else: print('invalid input to unpack()') | |
#wait its not nearly this simple... | |
#...I'll keep looking into this, gimme a bit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
refs:
https://docs.python.org/3/reference/expressions.html#calls
http://stackoverflow.com/questions/22098105/unpacking-more-than-one-list-as-argument-for-a-function
http://stackoverflow.com/questions/3480184/unpack-a-list-in-python