I'm attempting to keep my code to 80 chars or less nowadays as I think it looks more aesthetically pleasing, for the most part. Sometimes, though, the code ends up looking worse if I have to put line breaks in weird places.
One thing I haven't figured out how to handle very nicely yet is long strings. For example:
#0.........1........2........3........4.........5.........6.........7.........8xxxxxxxxx9xxxxxx
def foo():
if conditional():
logger.info("<Conditional's meaning> happened, so we're not setting up the interface.")
return
#.....
It's over! Putting it on the next line won't help either:
#0.........1........2........3........4.........5.........6.........7.........8xxxxxxxxx9xxxxxx
def foo():
if conditional():
logger.info(
"<Conditional's meaning> happened, so we're not setting up the interface.")
return
#.....
I could use line breaks but that looks awful:
#0.........1........2........3........4.........5.........6.........7.........8
def foo():
if conditional():
logger.info(
"<Conditional's meaning> happened, so we're not setting \
up the interface.")
return
#.....
What to do? Shortening the string is one option but I don't want the readability of my messages to be affected by something as arbitrary as how many indentation levels the code happened to have at that point.