Complex code hard to maintain
Complex code can be difficult to read and hard to maintain. For example, using three parameters in a single statement while slicing data, and comprehension with more than two subexpressions, can both be hard to understand.
def avoid_complex_comprehension_noncompliant():
    text = [['bar', 'pie', 'line'],
            ['Rome', 'Madrid', 'Houston'],
            ['aa', 'bb', 'cc', 'dd']]
    # Noncompliant: list comprehensions with more than two control
    # sub expressions are hard to read and maintain.
    text_3 = [y.upper() for x in text if len(x) == 3 for y in x
              if y.startswith('f')]
def avoid_complex_comprehension_compliant():
    text = [['bar', 'pie', 'line'],
            ['Rome', 'Madrid', 'Houston'],
            ['aa', 'bb', 'cc', 'dd']]
    text_1 = []
    # Compliant: easy to read and maintain.
    for x in text:
        if len(x) > 3:
            for y in x:
                text_1.append(y)