example_generator¶
- class docs_example.style_guide.example_generator(n)[源代码]¶
Generators have a
Yields
section instead of aReturns
section.- 参数
n (int) -- The upper limit of the range to generate, from 0 to n - 1.
- 生成器
int -- The next number in the range of 0 to n - 1.
实际案例
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]