On 01/05/13 12:12, boB Stepp wrote:
I have been looking through PEP 8--Style Guide for Python Code. It
recommends a maximum line length of 79 characters. What is the
preferred way to continue on another line or lines really long print
functions of string literals (Python 3)? The only thing that
immediately occurs to me is to break up the string literal into
multiple parts separated by + and break after the + . This seems to
use Python's built-in line continuation of anything between parens. Is
this the preferred way to do this?

Use Python's implicit string concatenation:

some_message = ("This is a really long line "
                "of text that Python automatically "
                "joins into a single string.")


The advantage of implicit concatenation is that it is guaranteed to
happen at compile-time, while the + operator may or may not occur until
run-time, depending on the version of Python.



--
Steven
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to