Skip to content

Instantly share code, notes, and snippets.

@satishgoda
Created February 21, 2014 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satishgoda/9129559 to your computer and use it in GitHub Desktop.
Save satishgoda/9129559 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
def foo(a, b="B", c=[], *args, **kwargs):
print(a, b, c)
if not args:
print("No *args passed")
else:
print(args)
if not kwargs:
print("No **kwargs passed")
else:
for k, v in sorted(kwargs.items()):
print(k, v)
if __name__ == '__main__':
foo(1, *["BBBBBBB", [1, 2, 3], 10, 20, 30, 40] , **{'kwa1':'one', 'kwa2':'two'})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment