3 ms·
Just try pasting the following into the default interpreter, exactly as-is: class Sample: def __init__(self): print('hehe') s = S
by brbsix 10y ago
Just try pasting the following into the default interpreter, exactly as-is:
class Sample:
def __init__(self):
print('hehe')
s = Sample()
IPython wouldn't flinch.
- gknoy 10y agoNote that if you're doing this in a terminal, you MIGHT need to first do `%cpaste`: https://gist.github.com/gknoy/97de793db43ff7ea4d4bfd1bab96b408 https://gist.github.com/gknoy/97de793db43ff7ea4d4bfd1bab96b4... It seemed to work fine when I didn't use `%cpaste`, though, so that might be a vestigial thing? (I remember having to do it on my linux workstation, so maybe it's just my mac terminal behaving differently.) The cool thing about directly pasting is, if you fumble the indentation like I did when I initially pasted, it auto-indents for you. ;)
- takluyver 10y agoIn previous releases, you had to use %cpaste. With IPython 5, so long as your terminal supports 'bracketed paste', it should just work. We'll probably deprecate %cpaste eventually. We got this feature with no effort on our part - it's built into prompt_toolkit.