zbexample package

Submodules

zbexample.sample module

exception zbexample.sample.ExampleError(msg, code)

Bases: exceptions.Exception

Exceptions are documented in the same way as classes.

The __init__ method may be documented in either the class level docstring, or as a docstring on the __init__ method itself.

Either form is acceptable, but the two should not be mixed. Choose one convention to document the __init__ method and be consistent with it.

Note

Do not include the self parameter in the Args section.

Parameters:
  • msg (str) – Human readable string describing the exception.
  • code (int, optional) – Error code.
msg

str – Human readable string describing the exception.

code

int – Exception error code.

zbexample.sample.a_generator(n)

Generators have a Yields section instead of a Returns 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]

zbexample.sample2 module

zbexample.utils module

Module contents