Python q

q is python module for Quick-and-dirty debugging output for tired programmers. Did you know about it? Toshio Kuratomi said about q yesterday and I use it now everywhere when I’m trying to debug things.

It allow you to easy print variables, function arguments, function returns to temp file when you executing code. Let’s see example:

#!/usr/bin/env python3
import q

@q
def q_test(var1=None, var2=None):
    print(q|var1 + var2)

def main():
    s = {'test': list(range(6))}
    q_test('arg', 'next')
    q.q(s)

if __name__ == '__main__':
    main()

After execution /tmp/q looks like:
Python q output

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments are closed.

  1. Anonymous says:

    That’s impressive; in particular, the ability to write @q when q came from import q is somewhat baffling.

css.php