Skip to content

Commit 6c0a0c2

Browse files
committed
-
1 parent 878531c commit 6c0a0c2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

source_py3/python_toolbox/monkeypatching_tools.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ def decorator(function):
8989

9090

9191
def change_defaults(function=None, new_defaults={}):
92+
'''
93+
Change default values of a function.
94+
95+
Include the new defaults in a dict `new_defaults`, with each key being a
96+
keyword name and each value being the new default value.
97+
98+
Note: This changes the actual function!
99+
100+
Can be used both as a straight function and as a decorater to a function to
101+
be changed.
102+
'''
92103
def change_defaults_(function_, new_defaults_):
93104
signature = inspect.Signature.from_function(function_)
94105
defaults = list(function_.__defaults__ or ())

0 commit comments

Comments
 (0)