Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'argument': 0.05; 'input,': 0.09; 'newline': 0.09; 'subject:()': 0.09; 'subtle': 0.09; 'subject:question': 0.10; 'cc:addr:python-list': 0.11; 'gui': 0.12; 'jan': 0.12; '(modulo': 0.16; 'file-like': 0.16; 'flush': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'merely': 0.16; 'wrote:': 0.18; 'not,': 0.20; 'input': 0.22; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'equivalent': 0.26; 'subject:/': 0.26; 'asking': 0.27; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; '(which': 0.31; 'sense': 0.34; "i'd": 0.34; 'but': 0.35; 'received:google.com': 0.35; 'representing': 0.36; "didn't": 0.36; 'method': 0.36; 'too': 0.37; 'level': 0.37; 'that,': 0.38; 'read': 0.60; 'lower': 0.61; 'simple': 0.61; "you're": 0.61; 'more': 0.64; '20,': 0.68; 'presented': 0.69; 'edwards': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=QTB9xN6AU+EuBdkkSoIq8PyNMl03T6nha6WsJRXSefw=; b=Xa9Tkl+W+OwG5Eo23MKKaD1+McZTdF/SZzg0cHgibsKSxrWRnuNVuMX/qUB75MptE0 M9/+FTE+O4+LCQVgk4lFPASE7etVB1NsxYqfaIuOyJDh+fl38DdgA+WnB5jU5Yr0Zle2 YEwDkkYLDuzHq5CGAHp2CDLjTXtqUWrK+75HIuuAmKGnhOlG0fvyJxYwxqVNOnc1sP6q ewksudOu/ANNd1KZcITXI/T9UhwmJH6KmT2KAwwI2zPO1bfHBFTbFU8FhZHZqyy2sb4d WM86g9aF10geusZYIVZgEZQooHLe09bqV+EM3r0Z9YRhBG2tkVnM510V3k6oe7TorT/w noIw== MIME-Version: 1.0 X-Received: by 10.66.43.135 with SMTP id w7mr13942210pal.97.1390154393497; Sun, 19 Jan 2014 09:59:53 -0800 (PST) In-Reply-To: References: Date: Mon, 20 Jan 2014 04:59:53 +1100 Subject: Re: question about input() and/or raw_input() From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1390154402 news.xs4all.nl 2891 [2001:888:2000:d::a6]:46770 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:64302 On Mon, Jan 20, 2014 at 4:42 AM, Grant Edwards wrote: > 2) I didn't claim that sys.stdin.readline() was as simple as using > input. I didn't claim it was preferable. I merely presented it as > a refutation to the argument that if you don't use input/raw_input > then you have to use a GUI toolkit. I'd draw a subtle distinction here, btw. With sys.stdin.readline(), you're asking to read a line from standard input, but with (raw_)input(), you're asking to read one line from the console. If it's been redirected, that's going to be equivalent (modulo newline handling), but if not, it would make sense for (raw_)input() to call on GNU Readline, where sys.stdin.readline() shouldn't. Calling a method on a file-like object representing stdin feels lower level than "ask the user for input with this prompt" (which might well do more than that, too - eg it might flush sys.stdout). ChrisA