Automation, Orchestration, and Scripting
A junior administrator is writing a helper function for a monitoring script. The function takes a host name and a timeout that defaults to 5 seconds. Which definition follows PEP 8 whitespace recommendations?
Show the answer
Correct answerA. def check(host, timeout=5):
PEP 8 says not to put spaces around = for a default value in an unannotated parameter, and not to put spaces before the opening parenthesis or just inside the parentheses. The version with spaces around = is the most tempting wrong option, but it breaks this rule.