[Python-ideas] Implicit string literal concatenation considered harmful?

Antonio Messina antonio.s.messina at gmail.com
Fri May 10 23:17:21 CEST 2013


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)

This should become (if I understand the proposal) something like:

    log.warning("Configuration item '%s' was renamed to " % oldkey +
                "'%s', please change occurrences of '%s'" % (newkey, oldkey) +
                " to '%s' in configuration file '%s'." % (newkey, filename))

but imagine what would happen if you have to rephrase the text, and
reorder the variables and fix the `+` signs...

On the other hands, I think I've only got the ``func("a" "b")`` error
once or twice in my life.

.a.


-- 
antonio.s.messina at gmail.com
antonio.messina at 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



More information about the Python-ideas mailing list