Advertisement
thinkdigital

Untitled

Dec 21st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. #article I got the idea from: https://www.codeproject.com/Articles/1078771/Techniques-for-Avoiding-Code-Duplication#example1
  2. def func1(func1arg):
  3.     print(func1arg)
  4.  
  5.  
  6. def func2(function_as_an_arg, param):
  7.     """
  8.  
  9.    :param function_as_an_arg: this can be a functionw
  10.    :type param: object => This parameter can be used as a parameter
  11.                            in the second function call.
  12.    """
  13.     function_as_an_arg(param)
  14.  
  15. #func1 is passed here and "Jonathan" is the parameter.
  16. func2(func1, "Jonathan")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement