
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 s = ("foo %s bar bogus" % (var1) "spam %s spam %s spam" % (var2, var3)) Would have to become s = (("foo %s bar bogus" % (var1)) + ("spam %s spam %s spam" % (var2, var3))) Because + has operator precedence over % otherwise, var1 would be concatenated with "spam %s spam %s spam" and then you would have substitution take place.