Inspecting values of default and optional arguments of a function

Hi everyone. First time poster here. I’m wondering if there is a neat way to access the values of default and optional arguments of a function? Suppose I have

julia> f(x, arg1=10.0, arg2=“Hello world”) = (x, arg1, arg2)

f (generic function with 3 methods)

I can inspect the different methods and the names of their associated arguments by doing

julia> methods(f).mt
#3 methods for generic function “f”:
[1] f(x) in Main at REPL[1]:1
[2] f(x, arg1) in Main at REPL[1]:1
[3] f(x, arg1, arg2) in Main at REPL[1]:1

(although I haven’t yet figured out how to capture this output as a String). However the default values of arg1 and arg2 are not here. Can anyone advise me on how to do this properly? Thanks.

For information: I’m trying to reproduce some of the functionality provided by python’s inspect package.

Colm