Skip to content

Conversation

@uschille
Copy link
Contributor

This PR attempts to resolve #258 where @tobyhodges suggested:

If we stick with image as the generic name for a variable containing image data loaded from a file, I think we should do two things:

  • add an Instructor note, recommending that Instructors guide learners to create a new Jupyter Notebook for each episode.
  • enforce an "only one variable named image per episode" policy: if any episodes contain multiple "different" image variables (i.e. where multiple files are loaded at different points in the episode), those variables should be named differently.

This PR would benefit from a critical look by a couple of eyes. It includes contributions from @drcandacemakedamoore and supersedes #259.

Inspired by @bobturneruk's code extraction script, I have written a rudimentary script to check the Python code in the epsiodes which turned out to be quite handy. Maybe one day I'll add this to the Makefile...

Copy link
Member

@tobyhodges tobyhodges left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is excellent, @uschille, thank you 🙌


* The possibility of executing the code cells in a notebook in arbitrary order can cause confusion. Using the "restart kernel and run all cells" feature is one way to accomplish linear execution of the notebook and may help to locate and identify coding issues.

* Many episodes in this lesson load image files from disk. To avoid name clashes in episodes that load multiple different files, we have used unique variable names (instead of generic names such as `image` or `img`). When copying code snippets between exercises, the variable names may have to be changed. The maintainers are keen to receive feedback whether this convention proves practical in workshops.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this explanation, thanks.

@tobyhodges tobyhodges merged commit 8d1293a into datacarpentry:gh-pages Apr 14, 2023
@uschille uschille deleted the rename-image-vars branch April 14, 2023 17:49
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.

Using image as a variable name

3 participants