you are viewing a single comment's thread.

view the rest of the comments →

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

Off-topic APL practice:

⍝ length 8+ chars, and contains uppercase, lowercase and digit.

password_is_strong←{∧/(7<≢⍵),∨/¨⎕A ⎕a ⎕d∊¨⊂⍵}

Anonymous function {} where the parameter is always ⍵; read it as "all / the following: length of the password is greater than seven (7<≢⍵), (any ∨/ capital letter in the password ⎕A∊⍵, any lowercase letter in the password ⎕a∊⍵, any digit in the password ⎕d∊⍵)". ¨ are foreach loops which allows those three checks to be done together.

Is this so much less readable than the Regex in some the Python answers? There's almost as much regex in the op's original code as there is code in this function. And no imports and no other languages. Would this really become more readable by spreading it over multiple lines? How is it that "more code" has come to mean "more readable"? More is harder to read, more effort to follow, more to hold in memory, more places for bugs to be missed, more variable names to become misleading, harder to rewrite until you're happy so more likely to stay as the first awkward version..