# How to Handle Variable Input List Length/Nesting in Custom Nodes (Python)

**URL:** <https://forum.dynamobim.com/t/how-to-handle-variable-input-list-length-nesting-in-custom-nodes-python/3192>\
**Category:** Developers\
**Created:** [February 16, 2016, 5:59pm UTC](https://forum.dynamobim.com/t/how-to-handle-variable-input-list-length-nesting-in-custom-nodes-python/3192 "2016-02-16T17:59:32Z")\
**Posts on this page:** 1\
**Showing post:** 19

<div class="post-metadata">

**Author:** ![Organon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/organon/32/161404_2.png) [@Organon](https://forum.dynamobim.com/u/Organon)\
**Post date:** [September 6, 2016, 11:51pm UTC](https://forum.dynamobim.com/t/how-to-handle-variable-input-list-length-nesting-in-custom-nodes-python/3192/19 "2016-09-06T23:51:59Z")

</div>

The Konrad’s function using lists comprehension:

```
elements = IN[0]

ProcessLists = lambda function, lists: [ProcessLists(function, item) if isinstance(item, list) else function(item) for item in lists]

sum = lambda x: x + 1

if isinstance(elements, list):
    out = ProcessLists(sum, elements)
else:
    out = sum(elements)

OUT = out

```

![](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/9/9570c95188a0cb9205837fd89ae548cd51ef05d1.gif)

---

_[View the full topic](https://forum.dynamobim.com/t/how-to-handle-variable-input-list-length-nesting-in-custom-nodes-python/3192)._
