title: Python3: List comprehension with named function definition possible?
body: <p>I'm using html-requests library but the library-specific knowledge doesn't matter that much in this question</p>
  
  <pre><code>results = asession.run(*[lambda m=j: get_size(m) for j in i])
  </code></pre>
  
  <p><code>asession.run(f1, f2, f3, ...)</code> asynchronously runs <code>f1()</code>,<code>f2()</code>,<code>f3()</code>, and so on, returning <code>[f3(), f1(), f2()]</code> (returned list order varies)</p>
  
  <p>The problem is, my <code>get_size</code> function can throw an error.</p>
  
  <p>So I'd like to set some fallback value.
  But with lambda expression, there's no way to insert try-except block. (lambda function only allows return value after :, not expression)</p>
  
  <p>Instead of</p>
  
  <pre><code>[lambda m=j: get_size(m) for j in i]
  </code></pre>
  
  <p>Is the following kind of code impossible?  (of course the following code is syntactically wrong)</p>
  
  <pre><code>[def fn(m=j): try: return get_size(m) except: return 0 for j in i]
  </code></pre>
  
  <p>Is the following the only way?</p>
  
  <pre><code>def fn(m):
      try:
          return get_size(m)
      except:
          return 0
  [lambda m=j: fn(m) for j in i]
  </code></pre>
  
  <p>I like some one-line list comprehension in my case and wonder there is any way to use named function definition (anything except lambda because lambda only allows return value hence is limited) inside list comprehension.</p>