3 ms·
Good piece. A (minor) nitpick. On section titled '''Prefer "pure" functions and generators''' two "dedupe" functions are shown. They are stated to be the same
by jqm 11y ago
Good piece.
A (minor) nitpick.
On section titled '''Prefer "pure" functions and generators''' two "dedupe" functions are shown. They are stated to be the same but aren't. The first function returns the number of duplicated elements excluded (an int). The second function returns a set of excluding duplicated elements. It's true (in the first function) that the original list "items" will be modified to exclude the duplicated elements but an additional unshown step is needed in the second to determine the number... i.e len(items) - len(set(items)).
- pixelmonkey 11y agoI agree. I opened PR #19 to address this: https://github.com/amontalenti/elements-of-python-style/pull/19 https://github.com/amontalenti/elements-of-python-style/pull... Would love to hear what you think of the changes.