Skip to content

Commit 161e6ad

Browse files
committed
Added module-level docstring showing basic use
1 parent 327de50 commit 161e6ad

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

cycler.py

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

0 commit comments

Comments
 (0)