why are *two* ctrl-D's needed with readline()

Donn Cave donn at u.washington.edu
Mon Oct 8 17:26:05 EDT 2001


Quoth "Wilhelm Fitzpatrick" <rafial at well.com>:
| --- In python-list at y..., Marcin 'Qrczak' Kowalczyk <qrczak at k...> wrote:
|> Fri, 5 Oct 2001 14:34:17 -0400, Steve Holden <sholden at h...> pisze:
|> 
|> > Technically ^D terminates transmission, and only raises EOF if this
|> > result in an empty input buffer, which it does if entered before
|> > inputting any characters.
|> 
|> So in normal circumstances programs shouldn't try to read after EOF
|> was seen, because it makes a difference for terminals.
|
| So would it be reasonable to report this as a bug?  Certainly, I found
| the behavior surprising and non-standard...

Steve's point was, if I recall correctly, that you shouldn't expect
EOF unless input was at beginning of line, from the point of view
of the TTY driver or whatever's emulating it.  So phrasing it as a
question - do you see this phenomenon when input is already at beginning
of line?  If you do, then it's a bug.

In the present case, I would guess that you have the GNU readline
module built in, and the bug is some interaction between that library,
on your version of Linux/glibc, and readlines().

	Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list