[FEATURE] Suggest using builtin functions when similar options exist
mx-psi opened this issue · 2 comments
The Python Standard Library has functions with similar behavior to some snippets.
In particular:
- The split_lines snippet has similar functionality to the
str.splitlines
method (the latter being more general and omitting the last line) and - the zip snippet has similar behavior to the
itertools.zip_longest
function (the latter returning an iterator instead of a list).
The functions don't have the exact same behavior, so it might make sense to keep them, but I believe it would be helpful for visitors to at least have a reference to the standard library version in the snippet documentation; that way they can choose the option that best fits their needs.
Thanks for informing us, I will look into these and add appropriate notes whenever possible. If you have more examples of this, you could either note them in the comments here or open a PR adding a line in each snippet's explanation, just before the code block noting that:
[`function.name`](library-link-to-function-name) provides similar functionality to this snippet.
Okay! I will check for other possible examples and open a PR