# Get the argument names of an function

**URL:** <https://discourse.julialang.org/t/get-the-argument-names-of-an-function/32902>\
**Category:** New to Julia\
**Created:** [January 3, 2020, 1:04am UTC](https://discourse.julialang.org/t/get-the-argument-names-of-an-function/32902 "2020-01-03T01:04:33Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [January 3, 2020, 9:25am UTC](https://discourse.julialang.org/t/get-the-argument-names-of-an-function/32902/3 "2020-01-03T09:25:06Z")

</div>

A hint is that Julia itself can print the arguments. So step into `show` with the debugger:

```julia
julia> using Debugger

julia> function f(x,y::Integer,z=3) # just for fun, add a type parameter
           p = x+y*z
           return p 
       end
f (generic function with 4 methods)

julia> m = first(methods(f))
f(x, y::Integer) in Main at REPL[5]:2

julia> @enter show(m)
In show(x) at show.jl:325
>325 show(x) = show(stdout::IO, x)

About to run: (typeassert)(Base.TTY(RawFD(0x0000000d) open, 0 bytes waiting), IO)
1|debug> se
In show(x) at show.jl:325
>325 show(x) = show(stdout::IO, x)

About to run: (show)(Base.TTY(RawFD(0x0000000d) open, 0 bytes waiting), f(x, y::Integer) in Main at REPL[5]:2)
1|debug> s
In #show#393(kwtype, , io, m) at methodshow.jl:159
 158 function show(io::IO, m::Method; kwtype::Union{DataType, Nothing}=nothing)
>159 tv, decls, file, line = arg_decl_parts(m)
 160 sig = unwrap_unionall(m.sig)
 161 ft0 = sig.parameters[1]
 162 ft = unwrap_unionall(ft0)
 163 d1 = decls[1]

About to run: Core.NewvarNode(:(_15))
1|debug> n
In #show#393(kwtype, , io, m) at methodshow.jl:159
 158 function show(io::IO, m::Method; kwtype::Union{DataType, Nothing}=nothing)
 159 tv, decls, file, line = arg_decl_parts(m)
>160 sig = unwrap_unionall(m.sig)
 161 ft0 = sig.parameters[1]
 162 ft = unwrap_unionall(ft0)
 163 d1 = decls[1]
 164 if sig === Tuple

About to run: (getproperty)(f(x, y::Integer) in Main at REPL[5]:2, :sig)
1|julia> decls
3-element Array{Tuple{String,String},1}:
 ("", "typeof(f)")
 ("x", "")        
 ("y", "Integer") 

```

---

_[View the full topic](https://discourse.julialang.org/t/get-the-argument-names-of-an-function/32902)._
