Open ZLLentz opened 3 years ago
Code should be easy to read and tabbed appropriately for general stylistic optimization and so that python editors can parse it properly.
There are several instances in the code that look like:
def some_method(): <...snip...> return f"""\ {name}: Target {target_state_num} {target_state} [{composition}] Target Position: {target_pos} [{t_units}] {diode_type}Diode Position(x, y): \ {x_motor_pos}, {y_motor_pos} [{d_units}] """
With the intention being that when the text is printed, it is printed without any leading tabbing.
Another way to accomplish this is:
import textwrap <...snip...> def some_method(): <...snip...> return textwrap.dedent( f""" {name}: Target {target_state_num} {target_state} [{composition}] Target Position: {target_pos} [{t_units}] {diode_type}Diode Position(x, y): \ {x_motor_pos}, {y_motor_pos} [{d_units}] """.lstrip()
My vim folds poorly and in vscode it looks odd
dedent(...).lstrip() to keep the meaning of the leading \
dedent(...).lstrip()
\
Added to the solution text, thanks Ken!
Expected Behavior
Code should be easy to read and tabbed appropriately for general stylistic optimization and so that python editors can parse it properly.
Current Behavior
There are several instances in the code that look like:
With the intention being that when the text is printed, it is printed without any leading tabbing.
Possible Solution
Another way to accomplish this is:
Context
My vim folds poorly and in vscode it looks odd