Skip to content

Make use of amax and amin more consistent#1117

Open
edbennett wants to merge 1 commit intoswcarpentry:mainfrom
edbennett:consistent-amax
Open

Make use of amax and amin more consistent#1117
edbennett wants to merge 1 commit intoswcarpentry:mainfrom
edbennett:consistent-amax

Conversation

@edbennett
Copy link
Copy Markdown
Contributor

The change in #995 left some instances of max and min present, which might cause learner confusion. This PR changes all of these that I could find to consistently use amax and amin. This required redrawing one diagram in SVG, and I made some related changes to using the full words "maximum" or "maxima" rather than "max" to be maximally explicit.

That said, I'm not sure that this is the correct course of action. The original intent of #995 was to make the lesson more consistent with the Numpy documentation, which discouraged use of min and `max. However, this seems to have been slightly premature:

  • Shortly after that PR was opened, Numpy switched the aliases such that amin and amax are now aliases for max and min, and the latter have the full documentation.
  • The discussion around this change indicates that the majority of code using Numpy uses these forms
  • There is currently no encouragement to use the amin, amax forms in the documentation.
  • numpy.min and numpy.max are not deprecated nor scheduled to be removed, so from numpy import * will overwrite our builtin namespace regardless of whether we use the amin, amax forms or not.
  • Part of the reasoning for the change was to make min and max work correctly with Dask, whereas amin and amax now will not (if I'm reading the discussion correctly)
  • Other functions that will clash with the builtin namespace, such as numpy.sum (which we use later in the lesson) do not have non-clashing aliases.

Based on this, it might be better to revert the numpy.amin and numpy.amax to numpy.min and numpy.max. If that is the preferred option, I can close this and open a fresh PR that does this.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 23, 2026

Thank you!

Thank you for your pull request 😃

🤖 This automated message can help you check the rendered files in your submission for clarity. If you have any questions, please feel free to open an issue in {sandpaper}.

If you have files that automatically render output (e.g. R Markdown), then you should check for the following:

  • 🎯 correct output
  • 🖼️ correct figures
  • ❓ new warnings
  • ‼️ new errors

Rendered Changes

🔍 Inspect the changes: https://github.com/swcarpentry/python-novice-inflammation/compare/md-outputs..md-outputs-PR-1117

The following changes were observed in the rendered markdown documents:

 02-numpy.md                                 |  12 +-
 fig/python-operations-across-axes.svg (new) | 394 ++++++++++++++++++++++++++++
 md5sum.txt                                  |   2 +-
 3 files changed, 401 insertions(+), 7 deletions(-)
What does this mean?

If you have source files that require output and figures to be generated (e.g. R Markdown), then it is important to make sure the generated figures and output are reproducible.

This output provides a way for you to inspect the output in a diff-friendly manner so that it's easy to see the changes that occur due to new software versions or randomisation.

⏱️ Updated at 2026-04-23 13:28:18 +0000

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant