I am trying to build a list from the values of a dictionary, and use the `get` method to handle the missing values:

```
dic = {'foo': 1, 'bar': 2}
list_values = [dic.get(k, 0) for k in ['foo', 'bar', 'baz']]
print(list_values)
>>> [1, 2, 0]

```

The thing is that I want to know how many times the `get` method returned the second option.

I know I could use a simple loop:

```
list_values = []
missing = 0
for k in ['foo', 'bar', 'baz']:
     if k in dic:
         list_values.append(dic[k])
     else:
         missing += 1
         list_values.append(0)

```

But it does not seem really pythonic compared to the list comprehension created beforehand.

Another idea would be to create a function and then use a wrapper to count the number of times the function was called, but *the function is called whether or not the key that is called with `get` exists*, as this simple example shows:

```
dic = {'a': 1}

# Do something to count the number of times the function was called
def missing_value():
    print('eh')
    return 0

print(dic.get('a', missing_value()))
>>> eh
>>> 1

```

Anyone has a simple and elegant solution or should I resolve to use the loop outside of a comprehension dict ?