diff --git a/README.md b/README.md index 64b14ae..647ee99 100644 --- a/README.md +++ b/README.md @@ -178,14 +178,16 @@ Point(x=1, y=2) Iterator -------- +**Iterator is any object with next() special method.** ```python -from itertools import count, repeat, cycle, chain, islice + = iter() # Calling `iter()` returns the same object. + = iter(, to_exclusive) # Sequence of return values until 'to_exclusive'. + = next( [, default]) # Raises StopIteration or returns 'default' on end. ``` +### Itertools ```python - = iter() - = iter(, to_exclusive) # Sequence of return values until 'to_exclusive'. - = next( [, default]) # Raises StopIteration or returns 'default' on end. +from itertools import count, repeat, cycle, chain, islice ``` ```python diff --git a/index.html b/index.html index e639f46..fddf545 100644 --- a/index.html +++ b/index.html @@ -320,12 +320,14 @@ Point(x=1, y=2 ('x', 'y')

#Iterator

-
from itertools import count, repeat, cycle, chain, islice
-
-
<iter> = iter(<collection>)
+

Iterator is any object with next() special method.

+
<iter> = iter(<collection>)                 # Calling `iter(<iter>)` returns the same object.
 <iter> = iter(<function>, to_exclusive)     # Sequence of return values until 'to_exclusive'.
 <el>   = next(<iter> [, default])           # Raises StopIteration or returns 'default' on end.
 
+

Itertools

+
from itertools import count, repeat, cycle, chain, islice
+
<iter> = count(start=0, step=1)             # Returns incremented value endlessly.
 <iter> = repeat(<el> [, times])             # Returns element endlessly or 'times' times.
 <iter> = cycle(<collection>)                # Repeats the sequence indefinitely.