Skip to main content

A printing debugging helper.

Project description

dprint

A printing debugging helper.

Motivation

dprint is inspired by a python-ideas thread, to show what's possible with a little bit of magic with plain Python code.

Installation

It's on PyPI as dprint. The obvious way will just work:

pip install dprint

Usage

Import the function dprint from the dprint module.

from dprint import dprint


def spam():
    eggs = 10
    dprint(eggs * 2)

spam()

Running the above script gives:

$ python script.py
script.py:6 in spam
  eggs * 2 -> 20

Operational Assumptions

The current logic for figuring out the expression passed to dprint operates under some assumptions:

  • The imported function must be called dprint
  • A call should span no more than 1 line
  • No more than 1 call on 1 line

A future version might relax these assumptions.

License

All files in this repository are under the MIT license.

Project details


Release history Release notifications

This version
History Node

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
dprint-0.1.0-py2.py3-none-any.whl (7.4 kB) Copy SHA256 hash SHA256 Wheel py2.py3
dprint-0.1.0.tar.gz (4.4 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page