Pep-8 in long constrs
OngoingHello. I am doing a Benders' decomposition problem and I have some questions. I have a long constraint and I am not sure the best way to do it. I would like to know if there is no problems if when I use Parenthesis and space. Also, I would like to know if I need to use indentation and what is the best option to to something like this. I will upload a picture with the code.
Best regards and thanks for your answer.
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Hi Cris,
As long as you are in a parenthesis of a function such as, e.g., \(\texttt{addConstr}\), you don't have to follow the Python indentation. However, it is strongly recommended to still indent such long expressions properly for the sake of readability.
Using whitespaces and parentheses can help in making your code more readable as you already did in the screenshot. You might have to re-read your code in a couple of weeks, months or even years and you will be glad then to have written a readable code to start off.
Best regards,
Jaromił0 -
Ok, thanks for your answer. So It is not indispensable use parentheses if I am coding inside a gurobi function. It is just stetic and readable issue.
Thanks for all Jaromił
Best regards.
0
Post is closed for comments.
Comments
3 comments