I wouldn't call it tricky, it's actually quite straightforward: import inspect
def extract_default(function, parameter): sig = inspect.signature(function) param = sig.parameters[parameter] return param.default def do_something(count=5): print(count) def do_something_twice(count=None): if count is None: count = extract_default(do_something, "count") do_something(count) do_something(count) _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/KVEGN4CKKK2SJX4GT67MNCHGZYHNHDKJ/ Code of Conduct: http://python.org/psf/codeofconduct/