Skip to content
/ q Public
forked from zestyping/q

Quick and dirty debugging output for tired programmers.

License

Notifications You must be signed in to change notification settings

abadger/q

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

q

Build Status

Quick and dirty debugging output for tired programmers.

Install q with pip install -U q.

All output goes to /tmp/q, which you can watch with this shell command:

tail -f /tmp/q

If $TMPDIR is set, the output goes to $TMPDIR/q. Note: Some alternatives to the TMPDIR variable are TEMP, TEMPDIR and TMP

To print the value of foo, insert this into your program:

import q; q(foo)

To print the value of something in the middle of an expression, insert "q()", "q/", or "q|". For example, given this statement:

file.write(prefix + (sep or '').join(items))

... you can print out various values without using any temporary variables:

file.write(prefix + q(sep or '').join(items))  # prints (sep or '')
file.write(q/prefix + (sep or '').join(items))  # prints prefix
file.write(q|prefix + (sep or '').join(items))  # prints the arg to write

To trace a function's arguments and return value, insert this above the def:

import q
@q

To start an interactive console at any point in your code, call q.d():

import q; q.d()

The following Lightning Talk shows how powerful using q can be.

About

Quick and dirty debugging output for tired programmers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.8%
  • Makefile 3.2%