On Thu, Sep 22, 2016 at 5:12 AM, Veek M <[email protected]> wrote:
> 2. Blank lines in my code within the editor are perfectly acceptable for
> readability but they act as a block termination on cmd line.
You can write a simple paste() function. For example:
import sys
paste = lambda: exec(sys.stdin.read(), globals())
>>> paste()
class Foo:
"""test class"""
def spam(self):
'''test method'''
return 'eggs'
>>> Foo().spam()
'eggs'
In a Unix terminal and IDLE, stdin.read() is terminated by typing
Ctrl+D at the start of an empty line. For the Windows console, it's
Ctrl+Z, Enter. Actually in a Unix terminal the cursor can also be at
the end of a line, but a bug in Python requires pressing Ctrl+D twice
in that case.
--
https://mail.python.org/mailman/listinfo/python-list