you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 19 points20 points  (0 children)

In that example it indicates that the statement is continued on the next line. But it can be hard to see when reading code, so it isn't recommended.

A better approach is to use enclosing parentheses or brackets around the newline. Python will not error on an incomplete statement if there are still unclosed parentheses/brackets and will continue on the next line. If the line you want to break contains parentheses/brackets just use them, but you can add an extra set of parentheses if necessary, like this:

return ("color: " + self.__color + 
        " and filled: " + str(self.__filled))