Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.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.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'anyway.': 0.05; 'hiding': 0.09; 'lawrence': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'imo,': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'coding': 0.22; 'cc:addr:python.org': 0.22; '2.x': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'equivalent': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'am,': 0.29; 'dec': 0.30; 'evaluation': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; '13,': 0.31; 'probably': 0.32; 'fri,': 0.33; '"the': 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'behind': 0.37; 'rather': 0.38; 'dangerous': 0.60; 'name': 0.63; 'more': 0.64; 'to:none': 0.92; '2013': 0.98 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=KT9q1kJ4wU3ffMRrMtkJtOnx5klyjpJO8hfYNuMduqc=; b=jYKL4AV9UpDZ/25HkOzn7Z1xtt4vkYWlTsvr6Gzq//ZySv9w4FQBsbuyEBYWpsrdCN FaKvWpq0ySj1cFG8ihdi9trfv+khGexYwnnWUEAHk7qnQyFtVirhKtHkGuHpKUMKh47S oysiycSFxP0cDmk3fskZb+GB0FGPdw4BFCSBUenIF47LV+PQ9sD3u/bLTZdCG42Q4hMM +8pubjv4H6Iu0c2DAJlcVhlw47QlfeUiaRNeePr2en/yQQDzrF0j2K5X0JcexCsSI/Bx 8LTVC6tzbkbZgx6d2DCb+hDpJa4Ze7Bsh4eH/eXAbz3UROPCyym99WkhTLuYvG+ibp/R PjFg== MIME-Version: 1.0 X-Received: by 10.68.236.133 with SMTP id uu5mr13036484pbc.153.1386861472345; Thu, 12 Dec 2013 07:17:52 -0800 (PST) In-Reply-To: References: <2ba69b81-99f9-40d6-a337-afb2f892ecff@googlegroups.com> Date: Fri, 13 Dec 2013 02:17:52 +1100 Subject: Re: input() on python 2.7.5 vs 3.3.2 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: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386861476 news.xs4all.nl 2879 [2001:888:2000:d::a6]:36631 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61729 On Fri, Dec 13, 2013 at 2:04 AM, Mark Lawrence wrote: > I much prefer Chris Angelico's response "The input() function in Python 2.x > is a very dangerous one - it's equivalent to eval(input()) in Python 3." Just to clarify: If you *want* eval, then you know you want it, and you are (or should be) aware of its dangers. The problem, imo, is hiding something as powerful and dangerous as code evaluation behind the innocuous name "input". If I were coding a Python 2.x REPL, I would probably write eval(raw_input()) rather than input(), just for clarity. But I'm more likely to just code for Python 3 anyway. :) ChrisA