# How to use \`which\`

**URL:** <https://discourse.julialang.org/t/how-to-use-which/129731>\
**Category:** General Usage\
**Tags:** parametric-types\
**Created:** [June 8, 2025, 2:47am UTC](https://discourse.julialang.org/t/how-to-use-which/129731 "2025-06-08T02:47:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GHTaarn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ghtaarn/32/216007_2.png) [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)\
**Post date:** [June 8, 2025, 2:47am UTC](https://discourse.julialang.org/t/how-to-use-which/129731/1 "2025-06-08T02:47:26Z")

</div>

The manual for the `which` function gives the following 3 variants:

```julia-repl
help?> which
search: which @which

  which(f, types)

  Returns the method of f (a Method object) that would be called for arguments of the given types.

  If types is an abstract type, then the method that would be called by invoke is returned.

  See also: parentmodule, and @which and @edit in InteractiveUtils.

  ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

  which(types::Type{<:Tuple})

  Returns the method that would be called by the given type signature (as a tuple type).

  ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

  which(module, symbol)

  Return the module in which the binding for the variable referenced by symbol in module was created.

```

Can anyone give an example of using the second variant? I have tried

```julia
which(Type{Tuple{Function,Vector}})

```

which results in a `MethodError`.

---

<div class="post-metadata">

**Author:** ![jakobjpeters](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakobjpeters/32/207797_2.png) [@jakobjpeters](https://discourse.julialang.org/u/jakobjpeters)\
**Post date:** [June 8, 2025, 5:19am UTC](https://discourse.julialang.org/t/how-to-use-which/129731/2 "2025-06-08T05:19:36Z")

</div>

It is a bit confusing, but there are two key facts that should clear things up. First, the type signature `::Type{T}` wants an instance of `T`.

```julia-repl
julia> T = Type{Int}

julia> typeof(T)
DataType

julia> T isa Type{T}
true

julia> Type{T} isa Type{Type{T}}
true

```

Second, the method requires the first parameter of this type to be the caller.

```julia-repl
julia> f(::Int, ::Float64) = 1;

julia> which(Tuple{typeof(f), Int, Float64})
f(::Int64, ::Float64)
     @ Main REPL[14]:1

```
