# Source

Simple, effective debug printing.

## Usage

from show import show

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

show(x, nums)


yields:

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)


with:

show(x)


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

show.set(where=True)


will turn on location reporting.

show.props(x) shows the properties of object x. 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

Sadly, because Python provides weaker introspection during interactive operation, (see e.g. this) show() is somewhat limited in interactive use. It works at the main level and usually in imported modules, but does work within the body of functions defined interactively.

## Notes

• show is the companion to, and built on the output management of, say.
• Automated multi-version testing is managed with the wonderful pytest and tox modules. 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).
• show has draft support for interactive Python and iPython. Works well at the interactive prompt, and within imported modules; it cannot, however, be used within interactively defined functions and classes. There may be a hard limit on Python introspection of interactive code. Or it could be something that can be worked around over time.
pip install show

python3.3 -m easy_install show