skip to navigation
skip to content

show 1.2.6

Debug print statements, done right. E.g. show(x)

from show import *

x = 12
nums = list(range(4))

show(x, nums)


x: 12  nums: [0, 1, 2, 3]

Output is self-labeled, so you don’t spend time doing that yourself.

Debug Printing

Logging, assertions, unit tests, and interactive debuggers are all great tools. But sometimes you just need to print values as a program runs to see what’s going on. Every language has features to print text, but they’re rarely customized for printing debugging information. show is. It provides a simple, DRY mechanism to “show what’s going on.”

Sometimes programs print so that users can see things, and sometimes they print so that developers can. show() is for developers, helping rapidly print the current state of variables in ways that easily identify what value is being printed, without a lot of wasted effort. It replaces the craptastic repetitiveness of:

print "x: {0!r}".format(x)



And Much More

While avoiding a few extra characters of typing and a little extra program complexity is nice (very nice, actually), show does much more. As just a taste, show.changed() displays local values that have changed since it was last run:

def f():
    x = 4
    x += 1
    retval = x * 3
    return retval

When run will display:

x: 4
x: 5  retval: 15

Decorate a function with @show.inout and it will show you the input parameters as the function is called, and then the return value later.:

def g(a):
    b = 3
    a += b
    return a



a: 7  b: 3
g(a=4) -> 7

And of course show does normal output too, just like say (with all of its high-level text formatting):

wizard = "Gandalf"
show("You have no power here, {wizard}!")


You have no power here, Gandalf!

Just like you knew it would.

Long story short, show is working toward being a full-featured debugging companion that prints the maximum amount of useful information with the minimum amount of fuss.

For this and much more, see the full documentation at Read the Docs.

New and Notable

A new capability is to differentially set the formatting parameters on a method by method basis. For example, if you want to see separators in green and function call/return annotations in red:


You could long do this on a call-by-call basis, but being able to set the defaults just for specific methods allows you to get more formatting in with fewer characters typed. This capability is available on a limited basis: primarily for format-specific calls (blanklines, hr, sep, and title) and for one core inspection call (the inout decorator). It will be extended, and mapped back to underlying say and options features over time.


There are known issues about running show on Python 3.5, and on Windows. Also, when evaluating this module’s usefulness, do so in a program file that you run, not interactively. It’s much more robust and effective in standard, non-interactive execution, given some challenges it currently faces getting cogent “where am I?” information from interactive interpreters.

File Type Py Version Uploaded on Size
show-1.2.6-py2.py3-none-any.whl (md5) Python Wheel 2.7 2015-09-01 21KB
show-1.2.6.tar.gz (md5) Source 2015-09-01 34KB (md5) Source 2015-09-01 47KB
  • Downloads (All Versions):
  • 49 downloads in the last day
  • 477 downloads in the last week
  • 2801 downloads in the last month