Which of these 3 python snippets is more pythonic?This 1 liner list comprehensions which is a little overcomplexusers_to_sent = [(my_database.get_user_by_id(x), group['num_sent'][x]) for x in user_ids]or this multi liner which is 'too many lines of code'users_to_sent = []for id in user_ids:    t1 = my_database.get_user_by_id(id)    t2 = group['num_sent'][id]    users_to_sent.append( (t1,t2) )or should the 1 liner be spun out into a separate function and called from a list comprehension? def build_tuple(x, my_database, group):    return (my_database.get_user_by_id(x), group['num_sent'][x])users_to_sent = [build_tuple(x, my_database, group) for x in user_ids]
Pythonic style guide
python
You'd definitely need to name your function something more descriptive than build_tuple for it to be a good idea (and same with t1 and t2 in the multi-liner!).  I'd use a function if it's something you do more than once or twice, otherwise I'd probably stick with the list comprehension - I find it easier to read than the multi-liner version.If I was doing a function, I'd probably make it generate the whole list - is there any reason not to do that?def make_users_to_sent(user_ids, my_database, group):    return [(my_database.get_user_by_id(x), group['num_sent'][x]) for x in user_ids]users_to_sent = make_users_to_sent(user_ids, my_database, group)