DEV Community

Discussion on: When is nesting good or neutral?

Collapse
 
codemouse92 profile image
Jason C. McDonald

From a Python perspective, we are informed by the Zen of Python

Flat is better than nested.

Python provides many patterns that allow one to avoid nesting in most cases. Of course, it's not altogether unavoidable, but you should try to avoid going any deeper than 2-3 levels, functions included.