python-distilled icon indicating copy to clipboard operation
python-distilled copied to clipboard

6.4 typos in line matching generator

Open marcoemorais opened this issue 2 years ago • 0 comments

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')

marcoemorais avatar Sep 04 '23 23:09 marcoemorais