oelin / quiet

Suppress the output of any Python function.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

quiet

Suppress the output of any Python function.

Usage

def add(x: int, y: int) -> int:
    """Add two numbers."""

    z = x + y

    print(f'{x} + {y} = {z}')

    return z
>>> add(1, 2)  # Returns 3.
1 + 2 = 3
>>> from quiet import quiet

>>> quiet(add)(1, 2)  # Returns 3.

About

Suppress the output of any Python function.

License:MIT License


Languages

Language:Python 100.0%