Skip to content

Commit c4e26a4

Browse files
committed
Merge pull request #5 from WeatherGod/docwork
DOC: Added module-level docstring showing basic use
2 parents bfe1cfd + 5a3c968 commit c4e26a4

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

cycler.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
"""
2+
Cycler
3+
======
4+
5+
Cycling through combinations of values, producing dictionaries.
6+
7+
You can add cyclers::
8+
9+
from cycler import cycler
10+
cc = (cycler('color', list('rgb')) +
11+
cycler('linestyle', ['-', '--', '-.']))
12+
for d in cc:
13+
print(d)
14+
15+
Results in::
16+
17+
{'color': 'r', 'linestyle': '-'}
18+
{'color': 'g', 'linestyle': '--'}
19+
{'color': 'b', 'linestyle': '-.'}
20+
21+
22+
You can multiply cyclers::
23+
24+
from cycler import cycler
25+
cc = (cycler('color', list('rgb')) *
26+
cycler('linestyle', ['-', '--', '-.']))
27+
for d in cc:
28+
print(d)
29+
30+
Results in::
31+
32+
{'color': 'r', 'linestyle': '-'}
33+
{'color': 'r', 'linestyle': '--'}
34+
{'color': 'r', 'linestyle': '-.'}
35+
{'color': 'g', 'linestyle': '-'}
36+
{'color': 'g', 'linestyle': '--'}
37+
{'color': 'g', 'linestyle': '-.'}
38+
{'color': 'b', 'linestyle': '-'}
39+
{'color': 'b', 'linestyle': '--'}
40+
{'color': 'b', 'linestyle': '-.'}
41+
"""
42+
143
from __future__ import (absolute_import, division, print_function,
244
unicode_literals)
345

0 commit comments

Comments
 (0)