Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1.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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'importing': 0.05; 'cheshire': 0.09; 'statements': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; "wouldn't": 0.14; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'imports': 0.16; 'math,': 0.16; 'measurement': 0.16; 'statements,': 0.16; 'followed': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'normally': 0.19; 'import': 0.22; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'file.': 0.24; 'cc:2**0': 0.24; 'right.': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'easier': 0.31; '25,': 0.31; 'comparison': 0.31; "d'aprano": 0.31; 'decimal': 0.31; 'steven': 0.31; 'time;': 0.31; "we're": 0.32; 'subject:with': 0.35; 'agree': 0.35; 'received:google.com': 0.35; 'are,': 0.36; 'false': 0.36; 'two': 0.37; 'list.': 0.37; 'pm,': 0.38; 'visual': 0.39; 'even': 0.60; 'simply': 0.61; 'love': 0.65; 'here': 0.66; 'benefit': 0.68; 'containing': 0.69; 'here!': 0.84; 'ridiculously': 0.84; 'to:none': 0.92; 'hoist': 0.93 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=Dqt6HAl+lVm5RuZ5XGVgR0+xmRVO8tUdhVEpPEUSwKo=; b=yLq6+7XI3L0z07psZZBRfTpR+rZSUWagh8H7igpqW2zIWJMrXkzG6KFEiSgVlwRYF8 lGrNnStEjqG8wCz/Tjj9ymDZSuUmfgQLs9cfnVXB1wEzirtISkkRTgJeW0Rf7cDgugiM 7yaw31QTcr2QK7QAy2DW1RZffJmRdu6w438EGpiH2QR5BjIXWDo0TDf9wSawb6kEqj2H x/BHDGQsRlq9am6awj3Qwjv93BZky3RYTGu8OM6JyyHfdl1yW4GouHBL9a9BqYFncUJF ig7H3GmYzWWqX1EeDOozV1pxgPD80t8oKzCG79IqFdvYcnbCUu0LfmKK3UMHjNopF9WL 4xBQ== MIME-Version: 1.0 X-Received: by 10.42.216.135 with SMTP id hi7mr21336730icb.12.1408933638698; Sun, 24 Aug 2014 19:27:18 -0700 (PDT) In-Reply-To: <53fa9c7b$0$29967$c3e8da3$5496439d@news.astraweb.com> References: <53fa9c7b$0$29967$c3e8da3$5496439d@news.astraweb.com> Date: Mon, 25 Aug 2014 12:27:18 +1000 Subject: Re: Working with decimals 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: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1408933645 news.xs4all.nl 2959 [2001:888:2000:d::a6]:54941 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76952 On Mon, Aug 25, 2014 at 12:16 PM, Steven D'Aprano wrote: > Joshua Landau wrote: > > >>>>> python -c "import sys; print('math' in sys.modules)" >> False >> >> An even easier check: >> >>>>> python -c "import time; a = time.time(); import math; b = time.time(); >>>>> print(b-a)" >> 0.0006012916564941406 >> >>>>> python -c "import math, time; a = time.time(); import math; b = >>>>> time.time(); print(b-a)" >> 9.5367431640625e-06 > > > I wouldn't exactly say that *two* calls to Python, each containing *five* > statements, followed by a visual comparison of two decimal numbers, > is "even easier" than a single call to Python, containing just two > statements :-) I love this list. We can go off on a ridiculously long tangent, simply because I said that it's only *usually* best to put imports at the top of the file. We all agree that it normally is indeed best to hoist them, and here we are, arguing over measurement methods on whether or not there's ever any benefit to importing inside a function. Yep, the Cheshire Cat was right. We're all mad here! ChrisA