Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed4.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.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'check,': 0.09; 'imported': 0.09; 'way:': 0.09; 'python': 0.11; '>>': 0.16; '24,': 0.16; 'namespace,': 0.16; 'sys.modules': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'module': 0.19; "hasn't": 0.19; 'aug': 0.22; 'email addr:gmail.com>': 0.22; 'math': 0.24; '>': 0.26; 'header:In- Reply-To:1': 0.27; 'skip:p 30': 0.29; 'thus': 0.29; '(like': 0.30; 'message-id:@mail.gmail.com': 0.30; 'there,': 0.34; 'subject:with': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'easy': 0.60; 'ian': 0.60; 'august': 0.61; 'making': 0.63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Ubsh+n/S43RXXTXpiqWZO6hA7Hk9ZXiWiS2S3id0To4=; b=DiDxk9qKs5uUc8QdrkT2jIy0c1g7vKReXbWnX2I4xBzLF6VaFJHNMAXjA+F5TnKMcP xmRmmaeGUt65jBylnSsUnhm/kLoqGkJSnesSWBJTuXSykEIYEOfordJj3iHs/V7mHiNU m4uWYPNe739BjkbQAzAv+zxskWsyUFSyG93FvAmeJdT1V2WHiL9/iMwaVt97qfSyjN1U D8MbBNmyhGFfRC1Jfr8J8aiyJCw3Wqd6BiddxT+Wlq6LctCQa+AOF3+hQQsNlwy/K7NS aQoAt0SGUrW2CvOk85l5hWmbx/AIbKWLta4c6pOesqGV/nVitSX35LSD13HmM/MAGlbo i+4g== X-Received: by 10.66.119.174 with SMTP id kv14mr22906852pab.52.1408909078817; Sun, 24 Aug 2014 12:37:58 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Sun, 24 Aug 2014 13:37:17 -0600 Subject: Re: Working with decimals To: Python Content-Type: multipart/alternative; boundary=e89a8ffbaa2529efde050165354b 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: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1408909088 news.xs4all.nl 2866 [2001:888:2000:d::a6]:35719 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76942 --e89a8ffbaa2529efde050165354b Content-Type: text/plain; charset=UTF-8 On Sun, Aug 24, 2014 at 1:25 PM, 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? > >> > >> Why would it be? > > > > It's easy to check, by the way: > > > > $ python -c "import sys; print(sys.modules['math'])" > > I don't mean into the global namespace, but imported by other modules > (like the builtins) and thus cached, making instantiation trivial. > sys.modules is the module cache. If it's not in there, then it hasn't been imported at all. --e89a8ffbaa2529efde050165354b Content-Type: text/html; charset=UTF-8
On Sun, Aug 24, 2014 at 1:25 PM, Joshua Landau <joshua@landau.ws> wrote:
On 24 August 2014 20:19, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> On Sun, Aug 24, 2014 at 1:17 PM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
>>
>> On Sun, Aug 24, 2014 at 1:12 PM, Joshua Landau <joshua@landau.ws> wrote:
>> > Is math not already imported by start-up?
>>
>> Why would it be?
>
> It's easy to check, by the way:
>
> $ python -c "import sys; print(sys.modules['math'])"

I don't mean into the global namespace, but imported by other modules
(like the builtins) and thus cached, making instantiation trivial.

sys.modules is the module cache. If it's not in there, then it hasn't been imported at all.
--e89a8ffbaa2529efde050165354b--