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


Groups > comp.lang.python > #81204

Re: Using Python for date calculations

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <random832@fastmail.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'operator': 0.03; 'irc': 0.05; 'subject:Python': 0.06; '21,': 0.07; 'function,': 0.09; 'received:internal': 0.09; 'to)': 0.09; 'typed': 0.09; 'accepting': 0.14; '"enter': 0.16; '(written': 0.16; 'calculator': 0.16; 'limiting': 0.16; 'literal.': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'code': 0.31; 'pickle': 0.31; '(i.e.': 0.33; 'fri,': 0.33; 'sense': 0.34; 'maybe': 0.34; 'received:66': 0.35; 'classes': 0.35; 'but': 0.35; 'there': 0.35; 'received:10': 0.37; 'clear': 0.37; 'sometimes': 0.38; 'nov': 0.38; 'to:addr:python- list': 0.38; 'anything': 0.39; 'channel': 0.39; 'to:addr:python.org': 0.39; 'removing': 0.60; 'from:no real name:2**0': 0.61; 'strictly': 0.61; "you're": 0.61; 'times': 0.62; 'header:Message-Id:1': 0.63; 'act': 0.63; 'number:': 0.66; '2014,': 0.84; 'fine...': 0.84; 'subject:Using': 0.84
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:x-sasl-enc:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=mesmtp; bh=CbjxZHITOelTq3I+HRoVJUe4mcU=; b=slvA JtzRbevKvvR0qUBSMLyXlGRZktII/r3nm3ML3+Te/3o9lmcRzf0VT9IKWOlpnlwI jfFZgTSxiuwWuYjO7Vskw2NQJEUiWpdvJtHVPpnmdY+WuhnALn6Kz3J/iUC5Qfn+ 9yBa9qNazcAIMUFoTCVqKlMvGjhJF2bM/NRzgu0=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:x-sasl-enc:from:to :mime-version:content-transfer-encoding:content-type:in-reply-to :references:subject:date; s=smtpout; bh=CbjxZHITOelTq3I+HRoVJUe4 mcU=; b=MazARPQQSah6HQCFgFbsT2AROdmx6C8Gg8SBy+ZMrBKxkUKv9yeDWl0Z E9LYP8CMVEBr4Z1KP64h8PO+MTkRs3CmfnQfEr+z7RVaxGB4tXkL7GuUqgzc56Eu p/aiLbWrhzmHv7Y2Xyh7Q+OZj1vIXzGbKP58Yt0M2vEboJ6SnBk=
X-Sasl-Enc qB044gWqmy93K0qKbPh1TUYZ7mYpS7yAk0J+m9vrcwBV 1416578293
From random832@fastmail.us
To python-list@python.org
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Content-Type text/plain
X-Mailer MessagingEngine.com Webmail Interface - ajax-a419c8a0
In-Reply-To <CAPTjJmpYBRa06+gwJiwjiEmGk0MOtX049Zx73ikEdzx0p59Rcg@mail.gmail.com>
References <k7tt6aheccqv06enkume0vs0v6kvvhns45@4ax.com> <mailman.16088.1416559225.18130.python-list@python.org> <e44u6a121qs79midbsfeotejdde9vbs2n9@4ax.com> <0yEbw.852077$KL.733426@fx19.am4> <CAPTjJmpYBRa06+gwJiwjiEmGk0MOtX049Zx73ikEdzx0p59Rcg@mail.gmail.com>
Subject Re: Using Python for date calculations
Date Fri, 21 Nov 2014 08:58:13 -0500
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16101.1416578295.18130.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416578295 news.xs4all.nl 2845 [2001:888:2000:d::a6]:50397
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81204

Show key headers only | View raw


On Fri, Nov 21, 2014, at 05:47, Chris Angelico wrote:
> 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.

Out of curiosity, is there a way to use eval "safely" (i.e. strictly
limiting what it has access to) across a privilege boundary? This also
comes up for pickle and other serialization formats that can store
arbitrary classes (i.e. call arbitrary constructors).

I remember an IRC channel I sometimes go in has a chatbot (written in
perl) which has a calculator function, it goes with the low-tech
solution of removing via regex anything that isn't an operator or a
number literal.

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


Thread

Using Python for date calculations Steve Hayes <hayesstw@telkomsa.net> - 2014-11-21 10:35 +0200
  Re: Using Python for date calculations Chris Angelico <rosuav@gmail.com> - 2014-11-21 19:40 +1100
    Re: Using Python for date calculations Steve Hayes <hayesstw@telkomsa.net> - 2014-11-21 12:15 +0200
      Re: Using Python for date calculations Chris Angelico <rosuav@gmail.com> - 2014-11-21 21:18 +1100
      Re: Using Python for date calculations alister <alister.nospam.ware@ntlworld.com> - 2014-11-21 10:33 +0000
        Re: Using Python for date calculations Chris Angelico <rosuav@gmail.com> - 2014-11-21 21:47 +1100
        Re: Using Python for date calculations random832@fastmail.us - 2014-11-21 08:54 -0500
          Re: Using Python for date calculations alister <alister.nospam.ware@ntlworld.com> - 2014-11-21 14:54 +0000
        Re: Using Python for date calculations random832@fastmail.us - 2014-11-21 08:58 -0500
          Re: Using Python for date calculations Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-22 01:55 +1100
            Re: Using Python for date calculations Ned Batchelder <ned@nedbatchelder.com> - 2014-11-21 10:25 -0500
        Re: Using Python for date calculations Chris Angelico <rosuav@gmail.com> - 2014-11-22 01:08 +1100
      Re: Using Python for date calculations Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-21 14:50 -0500
        Re: Using Python for date calculations Steve Hayes <hayesstw@telkomsa.net> - 2014-11-22 07:07 +0200
          Re: Using Python for date calculations Chris Angelico <rosuav@gmail.com> - 2014-11-22 16:13 +1100
  Re: Using Python for date calculations Gary Herron <gary.herron@islandtraining.com> - 2014-11-21 00:50 -0800
  Re: Using Python for date calculations Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-21 10:20 +0000
    Re: Using Python for date calculations alister <alister.nospam.ware@ntlworld.com> - 2014-11-21 10:38 +0000
    Re: Using Python for date calculations Steve Hayes <hayesstw@telkomsa.net> - 2014-11-21 17:50 +0200
      Re: Using Python for date calculations Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-21 16:01 +0000
  Re: Using Python for date calculations Chris Angelico <rosuav@gmail.com> - 2014-11-21 21:27 +1100
  Re: Using Python for date calculations duncan smith <buzzard@invalid.invalid> - 2014-11-21 17:03 +0000
    Re: Using Python for date calculations Steve Hayes <hayesstw@telkomsa.net> - 2014-11-21 21:48 +0200
      Re: Using Python for date calculations Dennis Lee Bieber <bieber.genealogy@earthlink.net> - 2014-11-21 15:32 -0500
  Re: Using Python for date calculations Dennis Lee Bieber <bieber.genealogy@earthlink.net> - 2014-11-21 14:35 -0500
    Re: Using Python for date calculations Paul Blair <p.blair@internode.on.net> - 2014-11-22 06:51 +1100
      Re: Using Python for date calculations Steve Hayes <hayesstw@telkomsa.net> - 2014-11-22 07:31 +0200
    Re: Using Python for date calculations Denis Beauregard <denis.b-at-francogene.com@fr.invalid> - 2014-11-21 15:07 -0500
      Re: Using Python for date calculations Steve Hayes <hayesstw@telkomsa.net> - 2014-11-22 07:34 +0200

csiph-web