We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 878531c commit 6c0a0c2Copy full SHA for 6c0a0c2
source_py3/python_toolbox/monkeypatching_tools.py
@@ -89,6 +89,17 @@ def decorator(function):
89
90
91
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
103
def change_defaults_(function_, new_defaults_):
104
signature = inspect.Signature.from_function(function_)
105
defaults = list(function_.__defaults__ or ())
0 commit comments