INNER CODE UNIT · Python

make_finite_stream

webartifex/intro-to-python · 08_mfr/stream.py:29

def make_finite_stream(min_=5, max_=15):
    """Simulate a finite stream of data.

    The returned stream is finite, but the number of elements to be produced
    by it is still random. This default behavior may be turned off by passing
    in `min_` and `max_` arguments with `min_ == max_`.

    Args:
        min_ (optional, int): minimum numbers in the stream; defaults to 5
        max_ (optional, int): maximum numbers in the stream; defaults to 15

    Returns:
        finite_stream (generator)

    Raises:
        ValueError: if max_ < min_
    """
    stream = _infinite_stream()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…