Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #3846

Re: Input() in Python3

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.047
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; '2.x': 0.05; "shouldn't": 0.07; 'pm,': 0.11; 'wrote:': 0.14; '"))': 0.16; 'expression.': 0.16; 'subject:() ': 0.16; 'subject:Python3': 0.16; 'header:In- Reply-To:1': 0.22; 'chris': 0.27; 'message-id:@mail.gmail.com': 0.28; 'string': 0.29; 'fri,': 0.29; 'to:addr:python-list': 0.32; 'someone': 0.33; 'should': 0.37; 'received:209.85': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'user': 0.38; 'no.': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'would': 0.40; 'header:Received:5': 0.40; 'simple': 0.60; '2011': 0.62; 'enters': 0.73; 'received:209.85.210.174': 0.84; 'received:mail- iy0-f174.google.com': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=R9JmVIgFupL2cAVKIp3n80frg8RIFuAdRP+soNZCgwI=; b=Z49BAHHGtjdCknars6P0q+PBgk5zI3E6YPALaEachRC9j6jdZCN70tWsVEBD1YnYCf IkbgBL/PkQe/noFXRp2VJaZxX4pWzsUSsFZuXnVddV2BwUvG8a8eAuvZ9mpMgg0FtR+r 3Y/SXx3a9EaL3yjSKl5Me6j3l/0cUNsuC9kok=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=FUh06H9qYuFaVFlKGOwkbAVjbkxwaQfo6ru24m+P59+nWI3sMXhUOs8m3llhnfOh5k UUl8CoidJjguuusYX1gP9AOo7WidcZ/Oeii/iXQlgXYFRXL2Ii3s6oo3ntFH4b2b34yk CYBRAvSZv7deYX9YtHzwtKRnm2eH+s52Lbwfo=
MIME-Version 1.0
In-Reply-To <I89sp.39115$yp3.5013@newsfe09.iad>
References <I89sp.39115$yp3.5013@newsfe09.iad>
Date Fri, 22 Apr 2011 16:49:19 +1000
Subject Re: Input() in Python3
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.731.1303454967.9059.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 82.94.164.166
X-Trace 1303454968 news.xs4all.nl 65870 [::ffff:82.94.164.166]:39307
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:3846

Show key headers only | View raw


On Fri, Apr 22, 2011 at 4:22 PM, harrismh777 <harrismh777@charter.net> wrote:
> now we get this for input():
>
>   raw_input("prompt>") --> string

I would have to say that the 2.x behaviour of input() is a mistake
that's being corrected in 3.x. With a simple name like input(), it
should do something simple and straightforward - not eval() the
expression.

> to:        a = eval(input("enter a number > "))

Uhhhh.... NO. NO NO NO. What if someone enters "os.exit()" as their
number? You shouldn't eval() unchecked user input!

Chris Angelico

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Input() in Python3 harrismh777 <harrismh777@charter.net> - 2011-04-22 01:22 -0500
  Re: Input() in Python3 Chris Angelico <rosuav@gmail.com> - 2011-04-22 16:49 +1000
  Re: Input() in Python3 Chris Angelico <rosuav@gmail.com> - 2011-04-22 16:50 +1000
  Re: Input() in Python3 Chris Rebert <clp2@rebertia.com> - 2011-04-22 00:46 -0700
    Re: Input() in Python3 harrismh777 <harrismh777@charter.net> - 2011-04-23 20:03 -0500
  Re: Input() in Python3 Westley Martínez <anikom15@gmail.com> - 2011-04-22 06:52 -0700
    Re: Input() in Python3 Mel <mwilson@the-wire.com> - 2011-04-22 10:08 -0400
      Re: Input() in Python3 Chris Angelico <rosuav@gmail.com> - 2011-04-23 06:25 +1000
        Re: Input() in Python3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-22 23:55 +0000
          Re: Input() in Python3 Chris Angelico <rosuav@gmail.com> - 2011-04-23 10:07 +1000
      Re: Input() in Python3 Westley Martínez <anikom15@gmail.com> - 2011-04-23 12:33 -0700
        Re: Input() in Python3 Mel <mwilson@the-wire.com> - 2011-04-25 12:50 -0400

csiph-web