example_generator¶
- class docs_example.style_guide.example_generator(n)[source]¶
Generators have a
Yields
section instead of aReturns
section.- Parameters
n (int) – The upper limit of the range to generate, from 0 to n - 1.
- Yields
int – The next number in the range of 0 to n - 1.
Examples
Examples should be written in doctest format, and should illustrate how to use the function.
>>> print([i for i in example_generator(4)]) [0, 1, 2, 3]