IPython 在 Mac Terminal 下自动缩进问题 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
rcglight

IPython 在 Mac Terminal 下自动缩进问题

  •  
  •   rcglight Oct 16, 2018 2921 views
    This topic created in 2750 days ago, the information mentioned may be changed or developed.
    macOS 下使用 Terminal,发现 IPython 的自动缩进有个比较奇怪的问题,求教一下大家:
    if/for/def 等语句,冒号之后,IPython 会自动换行,缩进一格
    如果再按一次 Enter,这两行代码就自动执行了
    如果想多写几行代码,应该怎么办呢?

    例如我的代码是这样子,输入完毕 print('hello')之后代码块就执行了,没有办法增加一行新的了
    In [10]: def say():
    ...: print(‘ hello ’)
    9 replies    2018-10-19 11:02:13 +08:00
    rcglight
        1
    rcglight  
    OP
       Oct 16, 2018
    发现了按 Ctrl-O 时,会再增加一行新的行
    不过这样又有了新问题,就是后面不会再自动缩进了[捂脸]
    rcglight
        2
    rcglight  
    OP
       Oct 16, 2018
    还有一个小问题,是关于 tab 自动补全的,为啥高亮的方法下方都标示了一个<unknown>
    例如
    a = ‘’
    a.<tab>
    弹出的 a.capitalize,a.casefold 这些方法下方都是<unknown>
    Detao
        3
    Detao  
       Oct 16, 2018
    我之前也发现这个问题了, 记得以前是不会直接执行的, 不知道什么时候变得不一样了. 懒得没仔细研究就切去用 jupyter notebook 了.
    rcglight
        4
    rcglight  
    OP
       Oct 17, 2018
    @Detao 多谢,暂时就先这么用用了
    rcglight
        5
    rcglight  
    OP
       Oct 17, 2018
    问题 post 到了 stack overflow 上,目前没人回复。。。
    quinoa42
        6
    quinoa42  
       Oct 17, 2018   1
    推荐一下[ptpython]( https://github.com/jonathanslenders/ptpython),相当于一个 TUI 的 ipython 前端(运行的时候运行 ptipython,ptpython 是 wrap 了 python 的原生 REPL )
    rcglight
        7
    rcglight  
    OP
       Oct 18, 2018
    @quinoa42 多谢多谢~我学习一下!
    Detao
        8
    Detao  
       Oct 18, 2018   1
    https://github.com/ipython/ipython/issues/11334 看样子是个 Bug, 但已经修掉了 ( https://github.com/ipython/ipython/pull/11358). 等 7.1 版本就好了. 或者你可以先装回 6.x 将就着用.
    rcglight
        9
    rcglight  
    OP
       Oct 19, 2018
    @Detao 喔唷 棒棒棒!那我等等!
    About     Help     Advertise     Blog     API     FAQ     Solana     3191 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 30ms UTC 14:13 PVG 22:13 LAX 07:13 JFK 10:13
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86