[issue18220] In itertools.islice() make prototype like in help()

py.user report at bugs.python.org
Fri Jun 21 19:31:33 CEST 2013


py.user added the comment:

[guest at localhost cpython]$ ./python
Python 3.4.0a0 (default, Jun 22 2013, 04:24:17) 
[GCC 4.7.2 20121109 (Red Hat 4.7.2-8)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> import itertools
>>> print(range.__doc__, slice.__doc__, itertools.islice.__doc__, sep='\n***\n')     
range(stop) -> range object
range(start, stop[, step]) -> range object

Returns a virtual sequence of numbers from start to stop by step.
***
slice(stop)
slice(start, stop[, step])

Create a slice object.  This is used for extended slicing (e.g. a[0:10:2]).
***
islice(iterable, [start,] stop [, step]) --> islice object

Return an iterator whose next() method returns selected values from an
iterable.  If start is specified, will skip all preceding elements;
otherwise, start defaults to zero.  Step defaults to one.  If
specified as another value, step determines how many values are 
skipped between successive calls.  Works like a slice() on a list
but returns an iterator.
>>>

I have updated the patch

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18220>
_______________________________________


More information about the Python-bugs-list mailing list