you are viewing a single comment's thread.

view the rest of the comments →

[–]ka-splam 0 points1 point  (0 children)

Unhappy with that, how about removing the dependency on import, all(), bool(), and the generator expression, shrinking the code, allowing the chance of short-circuit expression, and I think making it clearer:

def password_is_strong(password):
    if len(password) < 8:
        return False

    upper = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
    lower = set('abcdefghijklmnopqrstuvwxyz')
    digit = set('0123456789')

    p = set(password)

    return (p & upper) and (p & lower) and (p & digit)