do not use too many nested loops and conditions

Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.

Metadata

ID: python-best-practices/too-many-while

Language: Python

Severity: Warning

Category: Best Practices

Description

A program should have a maximum level of nesting loops. If your program has too many nested loops (if/for/while), consider refactoring your program to avoid too many nesting levels.

Non-Compliant Code Examples

while bla:
    while foo:
        while bar:
            while baz:
                pass

Compliant Code Examples

while bla:
    while foo:
        while bar:
            pass
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Seamless integrations. Try Datadog Code Analysis