Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'encoding': 0.05; 'subject:Python': 0.06; 'float': 0.07; 'javascript,': 0.07; 'problem:': 0.07; 'ugly': 0.07; 'assumed': 0.09; 'bytes,': 0.09; 'false.': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'part,': 0.09; '~ethan~': 0.09; 'bug': 0.12; 'jan': 0.12; '(which,': 0.16; 'discuss.': 0.16; 'roy': 0.16; 'sure.': 0.16; 'utc': 0.16; 'yup,': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'written': 0.21; 'header:User-Agent:1': 0.23; "i've": 0.25; 'handling': 0.26; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'chris': 0.29; '[1]': 0.29; 'am,': 0.29; "i'm": 0.30; 'code': 0.31; 'that.': 0.31; 'boundary': 0.31; 'class': 0.32; 'stuff': 0.32; 'text': 0.33; 'cases': 0.33; 'fri,': 0.33; 'subject:the': 0.34; 'could': 0.34; 'problem': 0.35; "can't": 0.35; 'common': 0.35; 'problem.': 0.35; 'but': 0.35; 'object,': 0.36; 'charset:us- ascii': 0.36; 'thanks': 0.36; 'seconds': 0.37; 'turn': 0.37; 'easily': 0.37; 'somebody': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'is.': 0.60; 'most': 0.60; 'received:173': 0.61; 'simple': 0.61; 'times': 0.62; 'information': 0.63; 'happen': 0.63; 'more': 0.64; 'different': 0.65; 'here': 0.66; 'direct': 0.67; 'smith': 0.68; 'ms.': 0.84; 'forgotten': 0.91; 'received:gateway02.websitewelcome.com': 0.91 Date: Thu, 09 Jan 2014 07:56:20 -0800 From: Ethan Furman User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: the Gravity of Python 2 References: <686$52cd4640$541826b9$21896@cache1.tilbu1.nb.home.nl> <52CE3416.9090501@stoneleaf.us> <7wiottej72.fsf@benfinney.id.au> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3304.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source-IP: 173.12.184.233 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([173.12.184.233]) [173.12.184.233]:47432 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 2 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3IzMzA0Lmhvc3RnYXRvci5jb20= 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: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1389285944 news.xs4all.nl 2961 [2001:888:2000:d::a6]:46317 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:63615 On 01/09/2014 06:57 AM, Chris Angelico wrote: > On Fri, Jan 10, 2014 at 1:14 AM, Roy Smith wrote: >> > > Thanks for this collection! Now we can discuss. [snip] >> Datetimes are self-describing. If I have a datetime or a timedelta, I >> know what I've got. I've written more than one bug where I assumed a >> number somebody handed me was in seconds but it turned out to be in ms. >> That can never happen with a timedelta. We do a lot of stuff in >> javascript, where times are ms, so this is a common problem for us. > > Sure. Though that's no different from other cases where you need > out-of-band information to understand something, as we've just been > discussing in the threads about text handling - if you have a puddle > of bytes, you can't decode them to text without knowing what the > encoding is. [1] If your data's coming from JS, it won't be a > timedelta, it'll be a number; at some point you have to turn that into > a timedelta object, so you still have the same problem. Yup, and you do at the boundary instead of having a float wandering through your code with an easily forgotten meta-data type. > So what I'm seeing here is that the direct use of a time_t will cover > everything in an ugly way, but that a class wrapping it up could fix > that. And fundamentally, the only problem with datetime (which, for > the most part, is exactly that wrapper) is that it's unobvious how to > get a simple UTC timestamp. It has at least one other problem: bool(midnight) == False. -- ~Ethan~ > [1] Yes, I said "puddle of bytes". What would you call it? Am > interested to hear! I think that's a perfect name! :)