0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

#python で #ruby の binding.pry みたいなことがやりたい ( IPython InteractiveShellEmbed で loop を次に進む )

Last updated at Posted at 2019-04-18
  • continue が効かない
  • next はなんか違う
  • exit で次に行けそう

script

#!/usr/bin/env python3
from IPython.terminal.embed import InteractiveShellEmbed
for i in range(5):
  ipshell = InteractiveShellEmbed()
  ipshell()

exe

Python 3.7.2 (default, Jan 13 2019, 12:50:01)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: i
Out[1]: 0
In [2]: i
Out[2]: 0
In [3]: continue
  File "<ipython-input-3-6ca52a340915>", line 4
SyntaxError: 'continue' not properly in loop

In [4]: break
  File "<ipython-input-4-6aaf1f276005>", line 4
SyntaxError: 'break' outside loop

In [5]: next
Out[5]: <function next>
In [6]: i
Out[6]: 0
In [7]: i
Out[7]: 0
In [8]: exit
Python 3.7.2 (default, Jan 13 2019, 12:50:01)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: i
Out[1]: 1
In [2]: exit
Python 3.7.2 (default, Jan 13 2019, 12:50:01)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: i
Out[1]: 2
In [2]: exit
Python 3.7.2 (default, Jan 13 2019, 12:50:01)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: i
Out[1]: 3
In [2]:

ref

Pythonの実行中にインタラクティブシェルを起動する - Qiita

Original by Github issue

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?