n00b question on spacing

Yves S. Garret yoursurrogategod at gmail.com
Fri Jun 21 17:17:28 EDT 2013


Hi, I have a question about breaking up really long lines of code in Python.

I have the following line of code:
log.msg("Item wrote to MongoDB database %s/%s" %(settings['MONGODB_DB'],
settings['MONGODB_COLLECTION']), level=log.DEBUG, spider=spider)

Given the fact that it goes off very far to the right on my screen is not
terribly
pleasing to my eyes (and can be rude for other developers).

I was thinking of splitting it up like so:
log.msg("Item wrote to MongoDB database %s/%s"
  %(settings['MONGODB_DB'], settings['MONGODB_COLLECTION']),
  level=log.DEBUG, spider=spider)

Is this ok?  Are there any rules in Python when it comes to breaking up
long lines of
code?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130621/f3f8582d/attachment.html>


More information about the Python-list mailing list