Double list comprehension:
[f(x) for x in range(5) for f in (f1,f2)]
Demo:
>>> f1 = lambda x: x
>>> f2 = lambda x: 10*x
>>> [f(x) for x in range(5) for f in (f1,f2)]
[0, 0, 1, 10, 2, 20, 3, 30, 4, 40]
More Related Contents:
- how to create a list of lists using list comprehension [closed]
- What does “list comprehension” and similar mean? How does it work and how can I use it?
- Flattening a shallow list in Python [duplicate]
- List comprehension vs map
- Is it Pythonic to use list comprehensions for just side effects?
- List comprehension rebinds names even after scope of comprehension. Is this right?
- Creating a dictionary from a csv file?
- Double Iteration in List Comprehension
- List comprehension vs generator expression’s weird timeit results?
- List vs generator comprehension speed with join function [duplicate]
- How can I do assignments in a list comprehension?
- Comprehension for flattening a sequence of sequences? [duplicate]
- How can I use a conditional expression (expression with if and else) in a list comprehension? [duplicate]
- How to return a subset of a list that matches a condition [duplicate]
- The truth value of an array with more than one element is ambigous when trying to index an array
- Why list comprehension is much faster than numpy for multiplying arrays?
- How to set local variable in list comprehension?
- Comprehension on a nested iterables?
- remove None value from a list without removing the 0 value
- How can I use list comprehensions to process a nested list?
- How to remove duplicate items from a list using list comprehension? [duplicate]
- sum each value in a list of tuples
- Converting List Comprehensions to For Loops in Python
- List comprehension scope error from Python debugger
- range(len(list)) or enumerate(list)? [duplicate]
- Creating a Python list comprehension with an if and break
- Square braces not required in list comprehensions when used in a function
- How to parallelize list-comprehension calculations in Python?
- Why is Python’s list comprehension loop order backwards? [duplicate]
- How does all() in python work on empty lists