Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!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.018 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.01; 'syntax': 0.04; 'variables': 0.07; 'string': 0.09; '22,': 0.09; 'msg': 0.09; 'subject:question': 0.10; 'suggest': 0.14; 'wrote': 0.14; 'so.': 0.16; 'wrote:': 0.18; 'skip:_ 20': 0.27; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'gold': 0.33; 'to:name :python-list': 0.33; 'skip:s 30': 0.35; 'johnson': 0.35; 'received:google.com': 0.35; 'skip:" 50': 0.36; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; "you're": 0.61; 'wish.': 0.84; 'rick': 0.93; '2013': 0.98 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=QCDg1QisZIqXeuZEm2FQllppKlWxzgpHv2q62XHXa1w=; b=Gtp2DNtN9eOgMVQQKclBiNt90uO8TigeQoYtTVUEB5sZYEP6zKhUDtbz1w/3e6AjH/ rcLCfF032QP6HCXXVtgxlu8EtcIUEBhNMzpcWCLbvK61RqLG/h7E7lnZ9gvIOJaiz5pq +7sE8tlFYDZlvOBiZLlOlcU2TuJ40TyJ2R0WqUw3j0mAQux3CBTCIYTt3SZyBnCIX2ns 6qgKdSBqYAHX8hFMUM19hynTsTRECp8kylb9bVj/gniCtVQUs6klibYG2jmbD5/7zOwL T8lT2rEtoUHrYNS4nlEOiID+anNdpjS35v0kmACNNdkBs5XDVOVXfDX8wyNWD2FoiWRP GKxQ== X-Received: by 10.112.52.97 with SMTP id s1mr9663990lbo.8.1371915664844; Sat, 22 Jun 2013 08:41:04 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <51870913-c348-4807-bc25-aa7c8fbf0001@googlegroups.com> References: <51C4D2FF.8000709@digipen.edu> <51870913-c348-4807-bc25-aa7c8fbf0001@googlegroups.com> From: Joshua Landau Date: Sat, 22 Jun 2013 16:40:24 +0100 Subject: Re: n00b question on spacing To: 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371915667 news.xs4all.nl 15881 [2001:888:2000:d::a6]:38147 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:48929 On 22 June 2013 16:24, Rick Johnson wrote: > On Saturday, June 22, 2013 8:36:43 AM UTC-5, Joshua Landau wrote: >> message = "Item wrote to MongoDB database " >> message += "{0[MONGODB_DB]}/{0[MONGODB_COLLECTION]}".format(settings) >> log.msg(message, level=log.DEBUG, spider=spider) > > If you're going to whore out parts of the string to > variables i would suggest going for the gold and actually > make it readable. Erm, as you wish. > Plus, your use of the format syntax is > incorrect. Wut? > _arg1 = settings['MONGODB_DB'] > _arg2 = settings['MONGODB_COLLECTION'] > _fmtstr = "Item wrote to MongoDB database {0}, {1}" > msg = _fmtstr.format(_arg1, _arg2) > log.msg(msg, level=log.DEBUG, spider=spider) > > If you want readability, now you got it. If you say so.