show / README.rst

Full commit

Simple, effective debug printing.


from show import show

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

show(x, nums)


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

Debug Printing

Sometimes programs print so that users can see things, and sometimes they print so that develpopers can. show() is for developers, helping rapidly print the current state of variables. It replaces require the craptastic repetitiveness of:

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



If you'd like to see where the data is being produced,:


will turn on location reporting. This can also be set on call-by-call basis. show is built atop the options module for configuration management, and also the output management of say. All say options work in show. See that module for additional detail.

Showing Collections

Showing Object Properties


shows the properties of object x. ("Properties" here is generic language for "values" or "attributes" associated with an object, and isn't used in the technical sense of Python properties.) Properties will be listed alphabetically, but with those starting with underscores (_), usually indicating "private" data, sorted after those that are conventionally considered public.

If x has real @property members, those too displayed. However, other class attributes that x rightfully inherits, but that are not directly present in the x instance, will not be displayed.

An optional second parameter can determine which properties are shown. E.g.:

show.props(x, 'name,age')

Or if you prefer the keyword syntax, this is equivalent to:

show(x, props='name,age')

Interactive Limitations

show has draft support for both interactive Python and iPython. It orks well at the interactive prompt, and within imported modules. It cannot, however, be used within functions and classes defined within the interactive session. This is due to how Python supprots--or fails to support--introspection in this instance. Whether this is a hard limit, or something that can be worked around over time, remains to be seen.

See e.g. this.


  • Automated multi-version testing managed with the wonderful pytest and tox. show is successfully packaged for, and tested against, all late-model verions of Python: 2.6, 2.7, 3.2, and 3.3, as well as PyPy 1.9 (based on 2.7.2).
  • The author, Jonathan Eunice or @jeunice on Twitter welcomes your comments and suggestions.


pip install show

To easy_install under a specific Python version (3.3 in this example):

python3.3 -m easy_install show

(You may need to prefix these with "sudo " to authorize installation.)