Last active
March 15, 2017 13:12
-
-
Save nishidy/be7f0e9b919ea4886e89f44d4a6a0b67 to your computer and use it in GitHub Desktop.
Variable length variable / Keyword variable length variable
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 func(a,b=10,*c,**d): | |
print(a,b,c,d) | |
func(1,20,30,40) | |
func([1,20,30,40]) | |
func({'a':1,'b':20,'c':30,'d':40}) | |
func(*[1,20,30,40]) | |
func(**{'a':1,'b':20,'c':30,'d':40}) | |
a = {1:10,2:20} | |
b = {3:30,4:40} | |
print({**a,**b}) |
Author
nishidy
commented
Mar 15, 2017
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment