# Why function names starting with '\_'?

**URL:** <https://discourse.julialang.org/t/why-function-names-starting-with/107696>\
**Category:** General Usage\
**Tags:** question\
**Created:** [December 16, 2023, 3:20am UTC](https://discourse.julialang.org/t/why-function-names-starting-with/107696 "2023-12-16T03:20:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiang\_ming\_zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jiang_ming_zhang/32/204063_2.png) [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Post date:** [December 16, 2023, 3:20am UTC](https://discourse.julialang.org/t/why-function-names-starting-with/107696/1 "2023-12-16T03:20:24Z")

</div>

I see many functions named like ‘\_my\_fun1’ in some package.

What is the purpose of such naming? I guess it is a standard practice in programing, right?

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [December 16, 2023, 3:29am UTC](https://discourse.julialang.org/t/why-function-names-starting-with/107696/2 "2023-12-16T03:29:43Z")

</div>

It’s just a common convention (probably borrowed from Python) to mark those functions as “very internal” or auxiliary.

See also [Prepended underscore in Base functions - #3 by stevengj](https://discourse.julialang.org/t/prepended-underscore-in-base-functions/19645/3)

---

<div class="post-metadata">

**Author:** ![jiang\_ming\_zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jiang_ming_zhang/32/204063_2.png) [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Post date:** [December 16, 2023, 4:14am UTC](https://discourse.julialang.org/t/why-function-names-starting-with/107696/3 "2023-12-16T04:14:43Z")

</div>

so these functions are generally not exported or imported?

---

<div class="post-metadata">

**Author:** ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)\
**Post date:** [December 16, 2023, 6:15am UTC](https://discourse.julialang.org/t/why-function-names-starting-with/107696/4 "2023-12-16T06:15:59Z")

</div>

It’s not a formal interface, but the idea is that users should not import these functions, you’re communicating that you don’t consider them stable, or that there’s an entry-point function users should be using instead.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [December 16, 2023, 2:35pm UTC](https://discourse.julialang.org/t/why-function-names-starting-with/107696/5 "2023-12-16T14:35:47Z")

</div>

> [@gustaphe](#):
>
> It’s not a formal interface, but the idea is that users should not import these functions, you’re communicating that you don’t consider them stable

Right, by now Julia has a public keyword to signal a function is part of an API. You should only use such functions or exported that also mean part of API. Otherwise you are in trouble area with or without \_ prefix.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [December 16, 2023, 5:14pm UTC](https://discourse.julialang.org/t/why-function-names-starting-with/107696/6 "2023-12-16T17:14:29Z")

</div>

It’s also useful when you want a helper function for you interface function, e.g. `foo`. Instead of coming up with a new separate name, or maybe `foo_helper`, you just name it `_foo`. It’s a crutch for us with poor imaginations, and signals that it has something to do with `foo`.
