# Force keyword argument input with keyword name for a function

**URL:** <https://discourse.julialang.org/t/force-keyword-argument-input-with-keyword-name-for-a-function/72575>\
**Category:** General Usage\
**Tags:** question\
**Created:** [December 4, 2021, 12:57pm UTC](https://discourse.julialang.org/t/force-keyword-argument-input-with-keyword-name-for-a-function/72575 "2021-12-04T12:57:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AtsushiSakai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/atsushisakai/32/6559_2.png) [@AtsushiSakai](https://discourse.julialang.org/u/AtsushiSakai)\
**Post date:** [December 4, 2021, 12:57pm UTC](https://discourse.julialang.org/t/force-keyword-argument-input-with-keyword-name-for-a-function/72575/1 "2021-12-04T12:57:48Z")

</div>

In python, we can force keyword argument input with keyword name for a function using “\*” like:

```julia
In [3]: def f(a, b, c=0, d=1):
   ...: pass
   ...:

In [4]: f(1, 2, 3, 4)

In [5]: f(1, 2, c=3, d=4)

In [6]: def f(a, b, *, c=0, d=1):
   ...: pass
   ...:

In [7]: f(1, 2, c=3, d=4)

In [8]: f(1, 2, 3, 4)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-8-0851ce1b6418> in <module>
----> 1 f(1, 2, 3, 4)

TypeError: f() takes 2 positional arguments but 4 were given

```

Is it possible to do it in Julia?

---

<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 4, 2021, 1:26pm UTC](https://discourse.julialang.org/t/force-keyword-argument-input-with-keyword-name-for-a-function/72575/2 "2021-12-04T13:26:01Z")

</div>

Yes, but it’s not quite the same. You can write

```julia
foo(a, b; c=0, d=1) = nothing

```

Then `c` and `d` are keyword arguments. But, unlike Python, you must _always_ specify the keyword name in Julia, and you can _never_ do it for positional arguments.
