Re: Output disappears when using interrupt key

Steven D. Majewski (sdm7g@elvis.med.virginia.edu)
Wed, 14 Apr 1993 14:59:21 -0400

Another curious "feature":

# file try2.py
import sys
def try2():
L = '######initial#string######'
try:
L = sys.stdin.readline()
print '#try: '+L
except:
print '#except: '+L
print '-OK.'
return L

>>> import try2
>>> try2.try2()
abc
#try: abc

'abc\012'
>>> try2.try2()
^C
#except:

-OK.
'\012'
>>> try2.try2()
aaaaaaa^Cbbbbbbb
#except: bbbbbbb

-OK.
'bbbbbbb\012'
>>>

Of the top of my head, I would have expected "aaaaaaa" ( or nothing )
rather than "bbbbbbb" .

But I expect that is is defined as "undefined" ? :-)

-Steve Majewski (804-982-0831) <sdm7g@Virginia.EDU>
-Univ. of Virginia Department of Molecular Physiology and Biological Physics