Skip to content

podhmo/pycomment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published