fastbook icon indicating copy to clipboard operation
fastbook copied to clipboard

Mistake in list comprehension explanation in chapter 4?

Open knjk04 opened this issue 3 years ago • 0 comments

image

In chapter 4 notebook, we have the above piece of text. Should the highlighted text instead end with 'before passing it to the function f'?

In a quick experiment I ran (see below), it looks like it first iterates over the list (nums), then filters and only then does it pass it to the function add_one.

image

Due to the placement of the comma in the highlighted sentence, I initially thought this meant that it filters the results of the function f to only take those that are positive. (Perhaps this is just my fault for my misinterpretation)

knjk04 avatar Mar 09 '22 07:03 knjk04