Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.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.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'causing': 0.04; 'subject:Python': 0.06; '21,': 0.07; 'plenty': 0.07; 'typed': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'accepting': 0.14; '"enter': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'stuff.': 0.16; 'typos': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'entered': 0.20; 'written': 0.21; 'command': 0.22; 'code,': 0.22; 'cc:addr:python.org': 0.22; '(or': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'fri,': 0.33; 'sense': 0.34; 'maybe': 0.34; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'crazy': 0.36; 'installing': 0.36; 'processed': 0.36; 'sequence': 0.36; 'doing': 0.36; 'clear': 0.37; 'system,': 0.38; 'problems': 0.38; 'nov': 0.38; 'issue': 0.38; 'pm,': 0.38; 'anything': 0.39; 'deleting': 0.60; 'gone': 0.61; "you're": 0.61; 'times': 0.62; 'act': 0.63; 'personal': 0.63; 'central': 0.64; 'virus': 0.65; 'number:': 0.66; 'risk': 0.72; 'fine...': 0.84; 'subject:Using': 0.84; 'to:none': 0.92; 'serious': 0.97 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=rsJPXK15zrEHYndZ3BRJBZu+RdowLVNUbiMqPOeKxhA=; b=XGez8wNpF5ZK33zplX6+GqWLgcpsMHDK+xMvuyTaPgOfuzv0YDN3dO5+o00RH1aLAR L6+s0S3K2Yhf8khnac19vDYVFdZxboaOV3g68cQ3xvCTisglrOC+LPnMcsy8rkADS82Z zUl9ox7THFulU70g/PwMC9TUB3r/Ewjjo0wSOiY+ZXjzZF4JEahbWjv9Ah9L7c42R3+8 1N17fvGkJFBfp0i6RnN9nAzH12ngh+iz7fg0itltXrM00iJSAnlTmgTyjt4+yO4prmxl 9KUbWnHUU9OPmLdPq7hPDmX/IVy7301W5ra29Lwj5C4LKy0s1YSwHp6nlEUUn4uwRz+P 6nZQ== MIME-Version: 1.0 X-Received: by 10.50.61.140 with SMTP id p12mr14545159igr.34.1416566878625; Fri, 21 Nov 2014 02:47:58 -0800 (PST) In-Reply-To: <0yEbw.852077$KL.733426@fx19.am4> References: <0yEbw.852077$KL.733426@fx19.am4> Date: Fri, 21 Nov 2014 21:47:58 +1100 Subject: Re: Using Python for date calculations 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416566886 news.xs4all.nl 2925 [2001:888:2000:d::a6]:57530 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81194 On Fri, Nov 21, 2014 at 9:33 PM, alister wrote: > the data entered by the user is processed as if it was python code, this > means the user could enter a command (or sequence of commands) that cause > serious problems to you computer including but not limited to:- > > Installing a virus > Deleting all your data > causing your central heating to explode (unlikely but if your central > heating is on your network anything is possible) That's the issue of malice. On a personal system, that's not really a question; there are plenty of programs I've written for my own use that have immense power. But there's also the risk of typos - one small error, and it's gone off doing crazy stuff. Now, maybe you want it to eval. There are times when I conceptually want "enter an integer", but it makes good sense to be able to type "1+2" and have it act as if I typed "3". That's fine... but if you want eval, write eval into your code. Be explicit: eval(raw_input("Enter a number: ")) makes it very clear that you're accepting code at the console. ChrisA