# List Process, list map in python

**URL:** <https://forum.dynamobim.com/t/list-process-list-map-in-python/5625>\
**Category:** Uncategorized\
**Created:** [August 15, 2016, 2:18pm UTC](https://forum.dynamobim.com/t/list-process-list-map-in-python/5625 "2016-08-15T14:18:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tomasz\_Puchala](https://avatars.discourse-cdn.com/v4/letter/t/5f9b8f/32.png) [@Tomasz\_Puchala](https://forum.dynamobim.com/u/Tomasz_Puchala)\
**Post date:** [August 15, 2016, 2:18pm UTC](https://forum.dynamobim.com/t/list-process-list-map-in-python/5625/1 "2016-08-15T14:18:20Z")

</div>

Hello,  
could you help me with some coding?.  
I’m trying to code the same logic as in red circle in python.  
Basically I don’t know how to processList intersection def.  
Need output like from “list.map” after does.intersect node. Hope it does make sense to you 😃

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/f/f3973d190c38c7690c448c3ce01bd0e10bbe3e27.png)

Python warning:  
"  
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.  
Traceback (most recent call last):  
File “”, line 10, in   
File “”, line 5, in ProcessList  
File “”, line 5, in \<lambda$170\>  
File “”, line 8, in Intersection  
TypeError: Solid is not iterable  
"

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [August 15, 2016, 2:25pm UTC](https://forum.dynamobim.com/t/list-process-list-map-in-python/5625/2 "2016-08-15T14:25:02Z")

</div>

Tomasz,

The `ProcessList()` method takes care of zipping the two arguments from lists. You don’t have to perform that inside your `Intersection()` method. Basically change it to:

```auto
def Intersection(elA, elB):
    return elA.DoesIntersect(elB) 

```

Then call it like so:

```auto
OUT = ProcessList(Intersection, ducts, walls)

```

Make sure that the two lists ducts and walls are exactly of the same structure. It works like this:

```auto
ducts = [duct1, duct2, duct3]
walls = [wall1, wall2, wall3]

```

Calling `ProcessList(Intersection, ducts, walls)` would result in a list `[bool, bool, bool]` where bool is a true/false if duct1 intersected wall1, duct2 intersected wall2 and duct3 intersected wall3.

It WILL NOT run duct1 against ALL walls, just pair them up. That’s how Zip() works.

---

<div class="post-metadata">

**Author:** ![Tomasz\_Puchala](https://avatars.discourse-cdn.com/v4/letter/t/5f9b8f/32.png) [@Tomasz\_Puchala](https://forum.dynamobim.com/u/Tomasz_Puchala)\
**Post date:** [August 15, 2016, 5:59pm UTC](https://forum.dynamobim.com/t/list-process-list-map-in-python/5625/3 "2016-08-15T17:59:12Z")

</div>

> [@Konrad\_K\_Sobon](#):
>
> def Intersection(elA, elB):  
> return elA.DoesIntersect(elB)

That makes sense. Thank you!

---

<div class="post-metadata">

**Author:** ![Einar\_Raknes](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/einar_raknes/32/8566_2.png) [@Einar\_Raknes](https://forum.dynamobim.com/u/Einar_Raknes)\
**Post date:** [August 15, 2016, 6:14pm UTC](https://forum.dynamobim.com/t/list-process-list-map-in-python/5625/4 "2016-08-15T18:14:47Z")

</div>

As already explained by Konrad your ProcessList and zip() are comparable to how List.Combine works in Dynamo.

If you need List.map you can use a nested for loop:

```
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

solids1 = IN[0]
solids2 = IN[1]
OUT = []

for s1 in solids1:
	sublist = []
	for s2 in solids2:
		sublist.append(s1.DoesIntersect(s2))
	OUT.append(sublist)

```

List.map, cross-product lacing and this python script will return the same:

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/c/c9a0cbd955ad59727e65122f8daf957b72c17db0.png)

If you like map(), this will do the same:

```
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

OUT = map(lambda s1: map(lambda s2: s1.DoesIntersect(s2), IN[0]), IN[1])
```

---

<div class="post-metadata">

**Author:** ![Tomasz\_Puchala](https://avatars.discourse-cdn.com/v4/letter/t/5f9b8f/32.png) [@Tomasz\_Puchala](https://forum.dynamobim.com/u/Tomasz_Puchala)\
**Post date:** [August 15, 2016, 8:46pm UTC](https://forum.dynamobim.com/t/list-process-list-map-in-python/5625/5 "2016-08-15T20:46:27Z")

</div>

That’s perfect. Thank you guys!
