# Inspecting values of default and optional arguments of a function

**URL:** <https://discourse.julialang.org/t/inspecting-values-of-default-and-optional-arguments-of-a-function/40277>\
**Category:** General Usage\
**Created:** [May 27, 2020, 5:11pm UTC](https://discourse.julialang.org/t/inspecting-values-of-default-and-optional-arguments-of-a-function/40277 "2020-05-27T17:11:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![colm-connaughton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/colm-connaughton/32/22519_2.png) [@colm-connaughton](https://discourse.julialang.org/u/colm-connaughton)\
**Post date:** [May 27, 2020, 5:11pm UTC](https://discourse.julialang.org/t/inspecting-values-of-default-and-optional-arguments-of-a-function/40277/1 "2020-05-27T17:11:07Z")

</div>

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
