Itertools docs edits

This commit is contained in:
Kodi Arfer 2017-01-04 15:11:54 -08:00
parent b9106de1ab
commit c8171bc0c5

View File

@ -26,8 +26,7 @@ Returns an iterator of all but the last item in *coll*.
=> (list (butlast [])) => (list (butlast []))
[] []
=> (import itertools) => (list (take 5 (butlast (count 10))))
=> (list (take 5 (butlast (itertools.count 10))))
[10, 11, 12, 13, 14] [10, 11, 12, 13, 14]
@ -994,8 +993,7 @@ Returns an iterator of all but the last *n* items in *coll*. Raises
=> (list (drop-last 100 (range 100))) => (list (drop-last 100 (range 100)))
[] []
=> (import itertools) => (list (take 5 (drop-last 100 (count 10))))
=> (list (take 5 (drop-last 100 (itertools.count 10))))
[10, 11, 12, 13, 14] [10, 11, 12, 13, 14]
@ -1288,20 +1286,17 @@ Included itertools
count cycle repeat accumulate chain compress drop-while remove group-by islice *map take-while tee zip-longest product permutations combinations multicombinations count cycle repeat accumulate chain compress drop-while remove group-by islice *map take-while tee zip-longest product permutations combinations multicombinations
--------- ---------
All of Python's itertools are available, however some of the names have been All of Python's `itertools <https://docs.python.org/3/library/itertools.html>`_
changed: are available. Some of their names have been changed:
- `starmap` has been changed to `*map` - ``starmap`` has been changed to ``*map``
- `combinations_with_replacement` has been changed to `multicombinations` - ``combinations_with_replacement`` has been changed to ``multicombinations``
- `groupby` has been changed to`group-by` - ``groupby`` has been changed to ``group-by``
- `takewhile` has been changed to `take-while` - ``takewhile`` has been changed to ``take-while``
- `dropwhile` has been changed to `drop-while` - ``dropwhile`` has been changed to ``drop-while``
- `filterfalse` has been changed to `remove` - ``filterfalse`` has been changed to ``remove``
Please refer to the `Python documentation
<https://docs.python.org/3/library/itertools.html>`_ for more information.