Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.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.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'imported': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; '24,': 0.16; 'be:': 0.16; 'math,': 0.16; 'namespace,': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; '>>>': 0.22; 'import': 0.22; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'math': 0.24; 'cc:2**0': 0.24; 'header :In-Reply-To:1': 0.27; 'thus': 0.29; "doesn't": 0.30; '(like': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'easier': 0.31; 'time;': 0.31; 'guess': 0.33; 'subject:with': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'false': 0.36; 'so,': 0.37; 'pm,': 0.38; 'even': 0.60; 'ian': 0.60; 'august': 0.61; 'making': 0.63; 'to:addr:gmail.com': 0.65 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=zxTlBPsunnlhXhnBZ9TW+6cmGwME3ZbOC0Mv3oqkJGA=; b=pYYI13prnYWfrWTMdF1fXqCocikPA9f/PGcB1GKcFeFe6gNTYCWniZk1T3anwaM1dB isS5kBejg9UGOrZkjIPurwFVfsLuki1XFJuKaBtevmQ0X+QxMjQeyoNvbJOWBgzw38Z0 FvBH3Vwn0UVzLc+e3knKrWYweHgHI4moo8Ig29+g93u7pPkqRw8tpR0drsm7gw8QTowZ FCnGelSVgnlUXxgzLNIVCL++aDEAuDIOWN7ts62+XZkXvgdTj/xvfw9rlXWDMcgJnkGx U15ywTPY9tJN4UsmNPq8V/JoROiXWcsC/UWoWmTaZmxIUZ5wVnpbByepwl+TU/+s9i+V jp+w== X-Received: by 10.152.207.99 with SMTP id lv3mr17054255lac.22.1408908598553; Sun, 24 Aug 2014 12:29:58 -0700 (PDT) MIME-Version: 1.0 Sender: joshua.landau.ws@gmail.com In-Reply-To: References: From: Joshua Landau Date: Sun, 24 Aug 2014 20:29:18 +0100 X-Google-Sender-Auth: QlK-jrqW5RvSL2DogFWXAYlnrz8 Subject: Re: Working with decimals To: Ian Kelly Content-Type: text/plain; charset=UTF-8 Cc: Python 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: 1408908600 news.xs4all.nl 2927 [2001:888:2000:d::a6]:59462 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76941 On 24 August 2014 20:25, Joshua Landau wrote: > On 24 August 2014 20:19, Ian Kelly wrote: >> On Sun, Aug 24, 2014 at 1:17 PM, Ian Kelly wrote: >>> On Sun, Aug 24, 2014 at 1:12 PM, Joshua Landau wrote: >>> > Is math not already imported by start-up? > > I don't mean into the global namespace, but imported by other modules > (like the builtins) and thus cached, making instantiation trivial. Although it doesn't seem to be: >>> 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 guess I'm just pessimistic. Even so, that's not much reason to hide the import inside a function.