python-distilled
python-distilled copied to clipboard
6.4 typos in line matching generator
The code snippet that appears after the generators used to match a pattern in lines read from a file contains some typos that will raise a NameError.
Change
from
paths = get_paths('.', '*.py')
files = get_files(pypaths)
lines = get_lines(pyfiles)
comments = get_comments(lines)
print_matching(comments, 'spam')
to
pypaths = get_paths('.', '*.py') # Replaced paths with pypaths.
pyfiles = get_files(pypaths) # Replaced files with pyfiles.
lines = get_lines(pyfiles)
comments = get_comments(lines)
print_matching(comments, 'spam')