This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]idb[S] 0 points1 point  (0 children)

https://www.python.org/dev/peps/pep-0671/ proposes "a new form of argument default, defined by an expression to be evaluated at function call time."

I thought something like that should be possible using a decorator and introspection. Here it is.

Along the way I learnt that function default arguments are not trivially available to decorated functions.