loading...

re: Python beyond PEP8 VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I would write that as: error = { "status": 400, "error": "images should be in uri format(http://img.png)" } Considerations: 4 spaces...
 

Thanks I'll make changes to my code.

However, I was asking if you have a really long string e.g. my error object, or a regex string. Is there a way to handle exceptionally long strings without using \ newline ?

Yes, you can do something like....

some_stirng = (
    "Bla bla bla bla. "
    "More bla bla bla bla. "
    "More bla bla bla bla"
)

Or use multi-line strings, but usually they are inconvenient because they will get the spaces from the indentation.

But keep in mind that this is about taste mostly and subjective, so do what ever you feel fits you and your team...

code of conduct - report abuse