Use nested list comprehension:
[x for x in [map_to_obj(v) for v in v_list] if x]
or better still, a list comprehension around a generator expression:
[x for x in (map_to_obj(v) for v in v_list) if x]
More Related Contents:
- Find a unique element in a list [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]
- Is it Pythonic to use list comprehensions for just side effects?
- List comprehension without [ ] in Python
- Generator expressions vs. list comprehensions
- Are list-comprehensions and functional functions faster than “for loops”?
- List comprehension on a nested list?
- Create list of single item repeated N times
- if else in a list comprehension [duplicate]
- Why is there no tuple comprehension in Python?
- How do I create a list of lambdas (in a list comprehension/for loop)?
- Transpose a matrix in Python [duplicate]
- Why is a list comprehension so much faster than appending to a list?
- List comprehension vs generator expression’s weird timeit results?
- Is it possible to use ‘else’ in a list comprehension? [duplicate]
- Comprehension for flattening a sequence of sequences? [duplicate]
- Advanced Nested List Comprehension Syntax
- Weird behavior: Lambda inside list comprehension [duplicate]
- `elif` in list comprehension conditionals
- Python using enumerate inside list comprehension
- Why list comprehension is much faster than numpy for multiplying arrays?
- How to remove multiple items from a list in just one statement?
- How to read aloud Python List Comprehensions?
- List with duplicated values and suffix
- Flattening a list of NumPy arrays?
- How do I convert a tuple of tuples to a one-dimensional list using list comprehension? [duplicate]
- flatten list of list through list comprehension
- Converting List Comprehensions to For Loops in Python
- Optimal method to find the max of sublist items within list