MickeyLater

None decorator

Feb 24th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. def none_decorator(func):
  2. """Decorator that prevents execution if the only parameter supplied is
  3. None.
  4.  
  5. :func: The function being decorated.
  6.  
  7. :returns: Return value of the function being decorated.
  8. """
  9. def none_deco(*args):
  10. if len(sys.argv) > 1:
  11. return func(*args)
  12.  
  13. return none_deco
Advertisement
Add Comment
Please, Sign In to add comment