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.129 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.80; '*S*': 0.06; 'subject:question': 0.10; 'cc:addr:python-list': 0.11; 'wrote': 0.14; 'mostly': 0.14; 'identifiers,': 0.16; 'readable': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'idea': 0.28; 'point': 0.28; 'message- id:@mail.gmail.com': 0.30; 'along': 0.30; 'lines': 0.31; 'keys': 0.31; "i'd": 0.34; 'received:google.com': 0.35; 'skip:" 50': 0.36; 'how': 0.40; 'is.': 0.60; 'more': 0.64; 'of:': 0.68; "it'd": 0.84; 'habit': 0.91; 'write:': 0.91; '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 :cc:content-type; bh=k0xoUYmhZnfzdVMZBNLZHGb502PiQ2IeZY0vvp9V1qM=; b=RSTXD4z0LnORN+1+gQ4izYGdvLAZZR9MPhgwyTv07ybz+Nv+FbRTtMlofvNGE7Yb9L 9EIjGeJGcPTQdoL5vs8ljHRvH1GRms/xvtU5LTdU26qj9KBU78FWhSewBWfugQYxwunH DtLnQK0K1tjJa9C3pIJEyH93taBfNhqddJPUAr6X6dCgyGv0O5PZd720raHGxJc9K5sR hQUFpB/VGZdZrIOX8Jz+zoE6lJMEfBm/yT8+PywbLMtk0QTY/scRiaZ5u37ReCLFZMjn guUeGzqhbmkoLLhyPy82fbvfSXSzpcnOZSi7PYWOyno6HkDQvYFkY//T5SsEmtZjyk1V FEeQ== X-Received: by 10.112.182.39 with SMTP id eb7mr9544140lbc.30.1371916287535; Sat, 22 Jun 2013 08:51:27 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <51C4D2FF.8000709@digipen.edu> From: Joshua Landau Date: Sat, 22 Jun 2013 16:50:47 +0100 Subject: Re: n00b question on spacing To: Gary Herron Content-Type: text/plain; charset=UTF-8 Cc: python-list 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371916294 news.xs4all.nl 15968 [2001:888:2000:d::a6]:43618 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:48930 On 22 June 2013 14:36, Joshua Landau wrote: > My favourite way would be along the lines of: > > message = "Item wrote to MongoDB database " > message += "{0[MONGODB_DB]}/{0[MONGODB_COLLECTION]}".format(settings) > log.msg(message, level=log.DEBUG, spider=spider) To make a habit of replying to myself, I thought I'd point out I wrote it this way mostly because I have no idea how big "settings" is. If it's not large and only contains keys that are valid identifiers, it'd be more readable to write: message = "Item wrote to MongoDB database " message += "{MONGODB_DB}/{MONGODB_COLLECTION}".format(**settings) log.msg(message, level=log.DEBUG, spider=spider)