def grouper(n, iterable, fillvalue=None):
"grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
args = [iter(iterable)] * n
- kwds = dict(fillvalue=fillvalue)
- return zip_longest(*args, **kwds)
+ return zip_longest(fillvalue=fillvalue, *args)
def roundrobin(*iterables):
"roundrobin('ABC', 'D', 'EF') --> A D E B F C"
Class :class:`Random` can also be subclassed if you want to use a different
basic generator of your own devising: in that case, override the :meth:`random`,
:meth:`seed`, :meth:`getstate`, and :meth:`setstate`.
-Optionally, a new generator can supply a :meth:`getrandombits` method --- this
+Optionally, a new generator can supply a :meth:`getrandbits` method --- this
allows :meth:`randrange` to produce selections over an arbitrarily large range.
Arguments are:
- *args* should be a string, or a sequence of program arguments. The program to
- execute is normally the first item in the args sequence or string, but can be
- explicitly set by using the executable argument.
+ *args* should be a string, or a sequence of program arguments. The program
+ to execute is normally the first item in the args sequence or the string if a
+ string is given, but can be explicitly set by using the *executable*
+ argument.
On Unix, with *shell=False* (default): In this case, the Popen class uses
:meth:`os.execvp` to execute the child program. *args* should normally be a
Class Random can also be subclassed if you want to use a different basic
generator of your own devising: in that case, override the following
methods: random(), seed(), getstate(), and setstate().
- Optionally, implement a getrandombits() method so that randrange()
+ Optionally, implement a getrandbits() method so that randrange()
can cover arbitrarily large ranges.
"""
>>> def grouper(n, iterable, fillvalue=None):
... "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
... args = [iter(iterable)] * n
-... kwds = dict(fillvalue=fillvalue)
-... return zip_longest(*args, **kwds)
+... return zip_longest(fillvalue=fillvalue, *args)
>>> def roundrobin(*iterables):
... "roundrobin('ABC', 'D', 'EF') --> A D E B F C"