title: Python list comprehension with complex data structures
body: <p>I'm trying to flatten some mixed arrays in Python using LC. I'm having some trouble figuring out how to structure it.</p>
  <p>Here's the array's i'm trying to flatten</p>
  <pre><code>arr_1 = [1, [2, 3], 4, 5]
  arr_2 = [1,[2,3],[[4,5]]]
  </code></pre>
  <p>I tried this methods for arr_1 but get &quot;TypeError: 'int' object is not iterable&quot;</p>
  <pre><code>print([item if type(items) is list else items for items in arr_1 for item in items])
  </code></pre>
  <p>So I decided to break it into parts to see where it's failing by using this</p>
  <pre><code>def check(item):
  return item;
  
  print([check(item) if type(items) is list else check(items) for items in [1, [2, 3], 4, 5] for items in arr_2]) 
  </code></pre>
  <p>Through the debugger I found that it's failing at the 2d array in</p>
  <pre><code>for items in [1, [2, 3], 4, 5]
  </code></pre>
  <p>I don't need the LC to be in one line but I just wanted to know how to do it in a single nested LC if its even possible.</p>