|
| 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 | + |
1 | 38 | from __future__ import (absolute_import, division, print_function,
|
2 | 39 | unicode_literals)
|
3 | 40 |
|
|
0 commit comments