[issue16774] Additional recipes for itertools docs
New submission from Alexey Kachayev: Additional recipes for itertools documentation (widespread functions in other programming languages): * drop * split-at * split-by ---------- assignee: docs@python components: Documentation files: itertools.doc.diff keywords: patch messages: 178098 nosy: asvetlov, docs@python, kachayev priority: normal severity: normal status: open title: Additional recipes for itertools docs versions: Python 3.4 Added file: http://bugs.python.org/file28427/itertools.doc.diff _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16774> _______________________________________
Changes by Ezio Melotti <ezio.melotti@gmail.com>: ---------- assignee: docs@python -> rhettinger nosy: +ezio.melotti, rhettinger stage: -> patch review type: -> enhancement versions: +Python 2.7, Python 3.2, Python 3.3 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16774> _______________________________________
Alexey Kachayev added the comment: Added: * takelast * droplast ---------- Added file: http://bugs.python.org/file28433/itertools.doc.v2.diff _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16774> _______________________________________
Alexey Kachayev added the comment: Updated patch with: * fix error in islice function name * made n=None default second argument for consume(iterator, n=None) cause it provides specific behavior when n is None which can be assumed as default for function ---------- Added file: http://bugs.python.org/file28768/itertools.doc.v3.diff _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16774> _______________________________________
Serhiy Storchaka added the comment: How are popular the proposed recipes? Not every possible combination of functions is worth to mention in the documentation. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16774> _______________________________________
Alexey Kachayev added the comment: It's hard to evaluate how popular given recipes, but: * drop is opposite to take, so it's as popular as take * the same situation with splitat, splitby - it's one case of partition that's hard to write each time with enumerator (partition is already in documentation) * takelast, droplast was added cause itertools.islice doesn't support negative indices (which is ok). both functions have not obvious implementation - I'm sure that recipes will be good example for users how to work with iterators even if concrete functions aren't so widely-spreaded ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16774> _______________________________________
Raymond Hettinger added the comment: I will add drop() to the recipes and possibly take_last() which I would rename add tail(). Sorry, I don't have interest in the others. I don't find them instructive or very useful. ---------- priority: normal -> low _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16774> _______________________________________
Changes by Raymond Hettinger <raymond.hettinger@gmail.com>: ---------- versions: +Python 3.5 -Python 2.7, Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16774> _______________________________________
Roundup Robot added the comment: New changeset 2781fb146f4a by Raymond Hettinger in branch 'default': Issue 16774: Add a new itertools recipe (suggested by Alexey Kachayev). http://hg.python.org/cpython/rev/2781fb146f4a ---------- nosy: +python-dev _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16774> _______________________________________
Raymond Hettinger added the comment: In the end, I decided to add a variant of take_last(). Thank you for the suggestion. ---------- resolution: -> fixed status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16774> _______________________________________
participants (5)
-
Alexey Kachayev
-
Ezio Melotti
-
Raymond Hettinger
-
Roundup Robot
-
Serhiy Storchaka