Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #48930 > unrolled thread

Re: n00b question on spacing

Started byJoshua Landau <joshua.landau.ws@gmail.com>
First post2013-06-22 16:50 +0100
Last post2013-06-22 16:50 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: n00b question on spacing Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-22 16:50 +0100

#48930 — Re: n00b question on spacing

FromJoshua Landau <joshua.landau.ws@gmail.com>
Date2013-06-22 16:50 +0100
SubjectRe: n00b question on spacing
Message-ID<mailman.3697.1371916294.3114.python-list@python.org>
On 22 June 2013 14:36, Joshua Landau <joshua.landau.ws@gmail.com> 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)

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web