pycomment

with repr value as comment


Install
pip install pycomment==0.1.1

Documentation

https://travis-ci.org/podhmo/pycomment.svg?branch=master

pycomment

Inserting repr value on comment with marker (marker is # =>). This is heavily inspired by xmpfilter of ruby's rocodetools

install

$ pip install pycomment

how to use

code.py

import sys

print("stderr", file=sys.stderr)
print("hello")
1 + 2 + 3 + 3 + 4 + 5  # =>
1 + 2 + 3 + 3 + 4 + 5  # =>
print("bye")
$ pycomment --inplace code.py
import sys

print("stderr", file=sys.stderr)
print("hello")
1 + 2 + 3 + 3 + 4 + 5  # => 18
1 + 2 + 3 + 3 + 4 + 5  # => 18
print("bye")


# -- stdout --------------------
# >> hello
# >> bye

multi-line output

import numpy as np

np.arange(9).reshape((3, 3))  # => multi-line..
# array([[0, 1, 2],
#        [3, 4, 5],
#        [6, 7, 8]])
# ..multi-line