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