# My Function does not work with input IN\[0\]?

**URL:** <https://forum.dynamobim.com/t/my-function-does-not-work-with-input-in-0/76708>\
**Category:** Developers\
**Tags:** python\
**Created:** [May 19, 2022, 2:25pm UTC](https://forum.dynamobim.com/t/my-function-does-not-work-with-input-in-0/76708 "2022-05-19T14:25:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [May 19, 2022, 2:25pm UTC](https://forum.dynamobim.com/t/my-function-does-not-work-with-input-in-0/76708/1 "2022-05-19T14:25:54Z")

</div>

Hello,

Learning…

Why does my function not work when the imput comes from IN[0] ? how can i convert my Input not beeing a list or viceversa, how can i change my code that is dealing with a list-imput, i need a loop at some place? inside the function or outside?

```auto

def concat(*args, sep="."):
    return sep.join(args)
    
x = concat(IN[0])

OUT = x

```

it is working:

```auto
def concat(*args, sep="."):
    return sep.join(args)
    
x = concat("earth", "mars", "venus")

OUT = x

```

How can i deal with the issue , whether i don`t know if it is a _list_ or a _single value_ ?  
 ![2022-05-19_16h25_15](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/a/aa3f6f9f4cb0476d6cfc7b1997d78f5f68a64cfb.png)

 ![2022-05-19_16h27_07](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/f/1f066a2d2b36ea48834c32dff410afb54cd52335.png)

KR

Andreas

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [May 19, 2022, 2:43pm UTC](https://forum.dynamobim.com/t/my-function-does-not-work-with-input-in-0/76708/2 "2022-05-19T14:43:58Z")

</div>

Hi,

This works for me, I’m not sure what the \* notation did, (I’m not that good at Python)…

You’ll see ‘isinstance’ in lots of nodes to ensure things are always in a list…

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/a/9a8f09ff0cb2c2c92a637f5de73316da9e622b4d.png)

Hope that helps,

Mark

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [May 19, 2022, 2:48pm UTC](https://forum.dynamobim.com/t/my-function-does-not-work-with-input-in-0/76708/3 "2022-05-19T14:48:26Z")

</div>

@Mark.Ackerley  
they call it KeyParameters … \*

There is a difference between _Positional Arguments_ and _Keyword Arguments_ ( As in my tutorial)  
Actually i can`t understand the topic

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [May 19, 2022, 2:54pm UTC](https://forum.dynamobim.com/t/my-function-does-not-work-with-input-in-0/76708/4 "2022-05-19T14:54:21Z")

</div>

Edit, you are right 🙂

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/5/95c1560eaf2af3a6a2955a1d27cacc178a1f0459.png)

> **[Understanding the asterisk(\*) of Python](https://medium.com/understand-the-python/understanding-the-asterisk-of-python-8b9daaa4a558)**
>
> I’m not a native speaker. Please understand.

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [May 19, 2022, 2:58pm UTC](https://forum.dynamobim.com/t/my-function-does-not-work-with-input-in-0/76708/5 "2022-05-19T14:58:23Z")

</div>

I guess it is failing because in Dynamo you are passing a List, which has a defined order?

My knowledge is now exhausted 😃

---

<div class="post-metadata">

**Author:** ![Michael\_Kirschner2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/michael_kirschner2/32/75576_2.png) [@Michael\_Kirschner2](https://forum.dynamobim.com/u/Michael_Kirschner2)\
**Post date:** [May 19, 2022, 3:14pm UTC](https://forum.dynamobim.com/t/my-function-does-not-work-with-input-in-0/76708/6 "2022-05-19T15:14:23Z")

</div>

this is correct, the message kind of contains the issue - \*args expects multiple arguments - ([variardic](https://en.wikipedia.org/wiki/Variadic_function#:~:text=In%20mathematics%20and%20in%20computer,dating%20back%20to%201936%E2%80%931937))

but you are not passing a variable number of strings, you are passing a single list.  
try this:

> <https://stackoverflow.com/questions/3941517/converting-list-to-args-when-calling-function>

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [May 19, 2022, 3:20pm UTC](https://forum.dynamobim.com/t/my-function-does-not-work-with-input-in-0/76708/7 "2022-05-19T15:20:54Z")

</div>

From my understanding `*args` means that you have x number of `arg` inputs to your function. Each argument still requires a singleton in this case, but you can provide as many as you like. A list is still not a singleton. It’s similar to the scalable nodes in Dynamo that allow for +/- number of inputs. You can provide any number of inputs but the structure of the input is still dependent on the function.

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [May 19, 2022, 5:25pm UTC](https://forum.dynamobim.com/t/my-function-does-not-work-with-input-in-0/76708/8 "2022-05-19T17:25:13Z")

</div>

if necessary, you can unpack your list at argument,  
example with 2 list

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/d/5dda5017d89af440e41f0c7518d8ac63cc6f7f69.png)
