Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate else/if conditional logic #49

Open
sadielbartholomew opened this issue Apr 10, 2024 · 0 comments
Open

Consolidate else/if conditional logic #49

sadielbartholomew opened this issue Apr 10, 2024 · 0 comments
Assignees

Comments

@sadielbartholomew
Copy link
Member

There are lots of locations in the code I have noticed where the conditional if/else logic can be streamlined or improved, so it flows more intuitively and reduces the need for extra levels of indentation, etc.

This is both in the sense of direct small-scale conversions, for example, there is a whole similar block that can be reduced with elif statements here:

cf-plot/cfplot/cfplot.py

Lines 8967 to 8990 in efe94c7

# Use accumulated plot limits if making a multiple line plot
if plotvars.graph_xmin is None:
plotvars.graph_xmin = minx
else:
if minx < plotvars.graph_xmin:
plotvars.graph_xmin = minx
if plotvars.graph_xmax is None:
plotvars.graph_xmax = maxx
else:
if maxx > plotvars.graph_xmax:
plotvars.graph_xmax = maxx
if plotvars.graph_ymin is None:
plotvars.graph_ymin = miny
else:
if miny < plotvars.graph_ymin:
plotvars.graph_ymin = miny
if plotvars.graph_ymax is None:
plotvars.graph_ymax = maxy
else:
if maxy > plotvars.graph_ymax:
plotvars.graph_ymax = maxy

as well as larger-scale changes to the conditional structure. All of which should not change the behaviour of the code in any way, only its implementation, to make it easier to work with and develop on top of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant