Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!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.035 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'formatting': 0.09; 'cc:addr:python-list': 0.11; '(there': 0.16; '24,': 0.16; 'function),': 0.16; 'function;': 0.16; 'rounding': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'import': 0.22; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header :In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'file': 0.32; "i'd": 0.34; 'subject:with': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'should': 0.36; 'too': 0.37; 'august': 0.61; 'you.': 0.62; 'times': 0.62; '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:sender:in-reply-to:references:from:date:message-id :subject:cc:content-type; bh=QJGRnQcCOPzvareTV307Y8wHA5wgMnhMUBVWH87KQlk=; b=uEfRGmrGZaEZsJh724bgvnTW/ZTQdJZs+Uob6DQ7zErAIDKVsGFKxY7Ixd8eqrhkbN LS4xLpvQW9FipILqtCTitxFantrI93uLq3quvvBFVH5aDLCPeVN3KVETp8tbQLCuzHa7 wySeVIrXirN07FLZTz4sfbWIOidTfxtRsZAQqDjHXB+aXxgb8Q+YplaZrSp9uuYF8gXJ YHtBdPcEWA99JhhJTOXosVj//1yn7amHv3Qk3vkRVw4LFaWTlthN58xZ2MdaFdC1djvE UUQOjgpPyioDJcRZjFsmvhy3fIePRIQVnAi5u1jj+tBcyt1wt8k/Zj10BOPNfMJUipx2 FR4g== X-Received: by 10.112.43.8 with SMTP id s8mr11442564lbl.47.1408834112430; Sat, 23 Aug 2014 15:48:32 -0700 (PDT) MIME-Version: 1.0 Sender: joshua.landau.ws@gmail.com In-Reply-To: References: From: Joshua Landau Date: Sat, 23 Aug 2014 23:47:52 +0100 X-Google-Sender-Auth: 1Sd-2FJRfT9Wq1V5ucdMR8ZljMo Subject: Re: Working with decimals Cc: python-list 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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1408834114 news.xs4all.nl 2910 [2001:888:2000:d::a6]:50194 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76909 On 23 August 2014 23:31, Chris Angelico wrote: > On Sun, Aug 24, 2014 at 7:47 AM, Joshua Landau wrote: >> So for one "import math" should never go inside a function; you should >> hoist it to the top of the file with all the other imports. > > I'd say "never" is too strong (there are times when it's right to put > an import inside a function), but yes, in this case it should really > be at the top of the function. But do any of them apply to "import math"? > However, you won't need the import at all if you let the formatting > function do the rounding for you. Can that floor?