The Daily WTF
Follow
Best of…: Classic WTF: Python Charmer
A Python code snippet generating passwords has been shared, showcasing sub-optimal coding practices.The method takes various parameters, including character length and verbosity.It generates passwords by concatenating characters from a word list based on the specified length.The code includes nested loops that create passwords of varying lengths by concatenating characters from the word list.Verbose mode prints the generated passwords.The code also supports generating passwords with all digits, lowercase letters, or uppercase letters.It checks if the generated password matches a list of specified characters.If a match is found, the loop terminates, resulting in a password consisting solely of the specified characters.The method writes the passwords to a file.Jakob, the author, expresses concern about the potential presence of a goto statement in the language.