Skip to content

Instantly share code, notes, and snippets.

@shaypal5
Created October 18, 2018 11:17
Show Gist options
  • Save shaypal5/bc208d67df4615423c7f97dacd691ee1 to your computer and use it in GitHub Desktop.
Save shaypal5/bc208d67df4615423c7f97dacd691ee1 to your computer and use it in GitHub Desktop.
Silence-able print one-liner for Python
def foo(a, quiet=False):
_print = (lambda x: x) if quiet else print
b = a * 5
_print("Warming up warp engines. This will not print if quiet is set to True.")
return b + 3.14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment