error={"status":400,"error":"images should be in uri format(http://img.png)"}
Considerations:
4 spaces indentation.
Closing bracket at the same level of indentation of the line containing the opening bracket.
Name, err_obj, everything in Python is an object, naming an object "object" does not explains what's the intention or meaning, like naming a view "view" or class "class". So that lefts us with err, and is not much to ask to write a full world: "err" -> "error", specially if this one is short.
Remember we think we are most of the time power typing, but that's not true, in reality most of the time we are reading code, staring into the abyss. Make your code clear, explicit, avoid useless redundancy and don't leave chance for miss interpretation.
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 ?
Does this apply to string literals?
lets say you have long strings like
I would write that as:
Considerations:
err_obj
, everything in Python is an object, naming an object "object" does not explains what's the intention or meaning, like naming a view "view" or class "class". So that lefts us witherr
, and is not much to ask to write a full world: "err" -> "error", specially if this one is short.Remember we think we are most of the time power typing, but that's not true, in reality most of the time we are reading code, staring into the abyss. Make your code clear, explicit, avoid useless redundancy and don't leave chance for miss interpretation.
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....
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...
I agree