Skip to content

Instantly share code, notes, and snippets.

@sigmavirus24
Forked from d34dh0r53/what_to_do.py
Last active October 3, 2016 12:47
Show Gist options
  • Save sigmavirus24/bbf342e524b4433e0aabae785f7ba9ff to your computer and use it in GitHub Desktop.
Save sigmavirus24/bbf342e524b4433e0aabae785f7ba9ff to your computer and use it in GitHub Desktop.
import argparse
B_DEFAULT = 'default_b'
def function_a(**kwargs):
arg_a = kwargs.pop('arg_a')
arg_b = kwargs.pop('arg_b', B_DEFAULT)
do_something(parsed_args.arg_a)
return something
def function_b(parsed_args):
function_a(arg_a=parsed_args.arg_a)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--arg_a", default="default_a")
parser.add_argument("--arg_b", default=B_DEFAULT)
args = parser.parse_args()
function_b(args)
function_a(arg_a=args.arg_a, arg_b=args.arg_b)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment