以repr值作为注释
pycomment的Python项目详细描述
pycomment
在带有marker的注释上插入repr值(marker是=>;)。 这很大程度上受到了ruby的rocodetools的xmpfilter的启发
安装
警告:未来(尚未)
$ pip install pycomment
如何使用
code.py
importsysprint("stderr",file=sys.stderr)print("hello")1+2+3+3+4+5# =>1+2+3+3+4+5# =>print("bye")
$ pycomment --inplace code.py
importsysprint("stderr",file=sys.stderr)print("hello")1+2+3+3+4+5# => 181+2+3+3+4+5# => 18print("bye")# -- stdout --------------------# >> hello# >> bye
多线输出
importnumpyasnpnp.arange(9).reshape((3,3))# => multi-line..# array([[0, 1, 2],# [3, 4, 5],# [6, 7, 8]])# ..multi-line
0.0.6
- 带缩进的多行输出(完全支持)(14)
0.0.4:
- 多线输出支持(12)
- -i选项已添加,与相同–就地(7)