
On Fri, May 10, 2013 at 11:53 PM, Ian Cordasco <graffatcolmingov@gmail.com> wrote:
On Fri, May 10, 2013 at 5:17 PM, Antonio Messina <antonio.s.messina@gmail.com> wrote:
My 2 cents: as an user, I often split very long text lines (mostly log entries or exception messages) into multiple lines in order to stay under 80chars (PEP8 docet), like:
log.warning("Configuration item '%s' was renamed to '%s'," " please change occurrences of '%s' to '%s'" " in configuration file '%s'.", oldkey, newkey, oldkey, newkey, filename)
Actually it would just become
log.warning(("Configuration item '%s' was renamed to '%s'," + " please change occurrences of '%s' to '%s'" + " in configuration file '%s'."), oldkey, newkey, oldkey, newkey, filename)
Perhaps without the inner set of parentheses. The issue of string formatting wouldn't apply here since log.* does the formatting for you. A more apt example of what they were talking about earlier is
You are right, I've picked up the wrong example. Please rephrase it using "raise SomeException()" instead of "log.warning()", which is the other case I often have to split the string over multiple lines: raise ConfigurationError("Configuration tiem '%s' was renamed to '%s'," " please change occurrences of '%s' to '%s'" " in configuration file '%s'." % (oldkey, newkey, oldkey, newkey, filename)) .a. -- antonio.s.messina@gmail.com antonio.messina@uzh.ch +41 (0)44 635 42 22 GC3: Grid Computing Competence Center http://www.gc3.uzh.ch/ University of Zurich Winterthurerstrasse 190 CH-8057 Zurich Switzerland