kuroko/test/testArgsKwargs.krk

31 lines
568 B
Python

def anything(*args, **kwargs):
def foo():
print("hi")
print("Positionals:", args)
print("Keywords:", kwargs)
return foo
anything(1,2,3,"a","b",foo="bar",biz=42)()
anything()()
def func(a,b,*args,**kwargs):
print(a, b, args)
let x = 'hello'
print(x)
return x
print(func(1,2,3,4,5,6,foo="bar"))
def last(a,b,c=1,d=2,**kwargs):
print("Main:", a, b, c, d)
print("Keyword:", kwargs)
last(1,2)
last(1,2,7,3)
last(1,2,test="thing")
try:
last(1,2,'c','d',7,8,extra='foo')
except as exception:
print(exception.arg)