Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'subject:Python': 0.06; 'string': 0.09; 'formatting': 0.09; 'parsing': 0.09; 'restriction': 0.09; 'cc:addr:python-list': 0.11; 'jan': 0.12; 'all?': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'roy': 0.16; 'utc': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'cc:addr:python.org': 0.22; 'question': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'argue': 0.31; 'asks': 0.31; 'regular': 0.32; 'subject:the': 0.34; "i'd": 0.34; 'received:google.com': 0.35; 'done': 0.36; "i'll": 0.36; 'possible': 0.36; 'so,': 0.37; 'pm,': 0.38; 'expression': 0.60; 'tell': 0.60; 'simple': 0.61; 'smith': 0.68; 'fact,': 0.69; 'etc,': 0.84; 'float,': 0.84; '"how': 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=yy7TpFHMkmLujgyJ3vhqfZmmH0TxpH6vVswaD3cxqAE=; b=xOs7yZjMzaIJ6dTwr+a46abzXzbjn4lRi/1vaQZQx6guz1Edo+6ye43zbrRsiSW6r6 RZ7YZIaLlGeJE4LfotcxHNH0BN4ux8wvFbwsnlZjkNUsCO+XHYoTzgJaZfGBqYrLTYaX UiojWwi5k0L5RqAl4p9H8QuK5mSoL1HRnFCB2iIUZzvAPsft25DvkxaLrNiiYiVWL0+E S36zEDMafenRJpGGc+hGSckfGbF5bkc1PJaurVx8qz/yTaY6SPOR3vbp4feS5wT0oWiF wkryniyoRgMMgmLlaXg89GpTgMw6bsUvfKhv4rpW8MPsAO8GxOj8kbfXQ+R+lC79rSUn 8f0w== MIME-Version: 1.0 X-Received: by 10.66.102.39 with SMTP id fl7mr1159785pab.43.1389242299992; Wed, 08 Jan 2014 20:38:19 -0800 (PST) In-Reply-To: References: <78d91$52cbf8e9$541826b9$29485@cache1.tilbu1.nb.home.nl> <4b702$52cc262e$541826b9$22985@cache80.multikabel.net> <4cbf$52cc2e82$541826b9$11761@cache70.multikabel.net> <686$52cd4640$541826b9$21896@cache1.tilbu1.nb.home.nl> Date: Thu, 9 Jan 2014 15:38:19 +1100 Subject: Re: the Gravity of Python 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: 1389242309 news.xs4all.nl 2895 [2001:888:2000:d::a6]:57211 X-Complaints-To: abuse@xs4all.nl X-Original-Bytes: 4608 Path: csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!backlog3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.81.MISMATCH!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:63569 On Thu, Jan 9, 2014 at 3:29 PM, Roy Smith wrote: > So, I'd like to see your code which generates an aware UTC datetime > object in Python. And then we can argue about whether it's simple or > not :-) In fact, I'll go further. Why do you need a datetime object at all? What is it that you need? Arithmetic can be done with int and/or float, parsing and formatting can be done with time.str[pf]time, etc, etc. It's like if someone asks "How can I build a regular expression that will tell me if a string is valid JSON?". The question poses a restriction that may be unnecessary, and may eliminate all possible answers. ChrisA