DEV Community

Discussion on: 10 Python Interview Questions and Answers for Freshers

Collapse
 
ocasoprotal profile image
OcasoProtal

Look how unreadable it is. This is the main reason to avoid list comprehension because it makes code hard to read for humans.

No, you should not avoid list comprehensions, you should avoid unreadable code! That's quite a difference.

Collapse
 
digvijaysingh profile image
Digvijay Singh

I agree. We can definitely use list comprehension to make out code look short and beautiful but complex logic in a list comprehension must be avoided.