Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'think,': 0.07; '*is*': 0.09; 'exit': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'jan': 0.12; 'eof': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'unix,': 0.16; 'wrote:': 0.18; 'differ': 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; "i've": 0.25; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'run': 0.32; 'something': 0.35; 'case,': 0.35; 'done.': 0.35; 'handle': 0.38; 'to:addr:python-list': 0.38; 'received:71': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'tell': 0.60; 'received:fios.verizon.net': 0.84; 'canonical': 0.91; 'edwards': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: open() and EOFError Date: Tue, 08 Jul 2014 11:08:44 -0400 References: <53ba11fc$0$29985$c3e8da3$5496439d@news.astraweb.com> <53ba538d$0$2926$c3e8da3$76491128@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-71-175-90-87.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1404832156 news.xs4all.nl 2923 [2001:888:2000:d::a6]:49786 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74170 On 7/8/2014 10:19 AM, Grant Edwards wrote: > On 2014-07-07, Gregory Ewing wrote: >> Terry Reedy wrote: >>> Avoid EOFError. Much better, I think, is the somewhat customary >>> >>> s = input("Enter something, or hit to exit") >>> if not s: sys.exit() >>> else: >> >> I beg to differ -- on Unix, Ctrl-D *is* the customary >> way to exit from something that's reading from stdin. > > Indeed. Ctrl-D is _the_ canonical way to tell a program that's > reading stdin that your're done. Not on Windows. > I've never run across "hit to exit". > >> In any case, you need to be able to handle EOF gracefully if the user >> uses it. > -- Terry Jan Reedy