Skip to content

Instantly share code, notes, and snippets.

@d9k
Created September 22, 2015 23:32
Show Gist options
  • Save d9k/e18a31f6730e0ffc50de to your computer and use it in GitHub Desktop.
Save d9k/e18a31f6730e0ffc50de to your computer and use it in GitHub Desktop.
>>>
def t(*args):
return p(*args)
>>>
def p(*args):
i = 0
for arg in args:
i += 1
print('i='+str(i)+': '+str(arg))
>>>
def p(*args):
i = 0
for arg in args:
i += 1
print(str(i) + ') ' + str(arg))
>>> t(6, 1, 5)
1) 6
2) 1
3) 5
>>>
def t(*args, **kwargs):
return p(*args, **kwargs)
>>>
def p(*args, **kwargs):
i = 0
for arg in args:
i += 1
print(str(i) + ') ' + str(arg))
for key, value in kwargs.items():
print(str(key) + ') ' + str(str(value)))
>>> t('a', 'za', 'za', t=45, yo=19)
1) a
2) za
3) za
yo) 19
t) 45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment