Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created May 11, 2024 10:17
Show Gist options
  • Save mypy-play/2d08ee75a0efb537303a3b3fd4648c32 to your computer and use it in GitHub Desktop.
Save mypy-play/2d08ee75a0efb537303a3b3fd4648c32 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
from collections.abc import Callable
def pprint(obj: object, repr_fn: Callable[..., str] = NotImplemented):
repr_fn = (
repr_fn if repr_fn is not NotImplemented
else repr
)
return repr_fn(obj)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment