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

Code snippet docstring formatting #291

Closed
deppen8 opened this issue Aug 7, 2023 · 4 comments · Fixed by #293
Closed

Code snippet docstring formatting #291

deppen8 opened this issue Aug 7, 2023 · 4 comments · Fixed by #293

Comments

@deppen8
Copy link
Contributor

deppen8 commented Aug 7, 2023

We have a number of Python code snippets that include a docstring where each new line starts with *. I think "canonical" Python formatting would tell us to use a one-line triple-quoted description.

So this:

"""
 * Python libraries for learning and performing image processing.
 *
"""
import numpy as np
import matplotlib.pyplot as plt
import ipympl
import imageio.v3 as iio
import skimage

Would become this:

"""Python libraries for learning and performing image processing."""

import numpy as np
import matplotlib.pyplot as plt
import ipympl
import imageio.v3 as iio
import skimage

Thoughts?

@bobturneruk
Copy link
Contributor

Python has several different docstring formats - sorry for the dated reference. I don't think there's a canonical format, but happy to be corrected!

I think here the docstrings are being used as comments so it's probably not critical that they are in a particular format, as long as they are consistent, other than to model good practise.

@deppen8
Copy link
Contributor Author

deppen8 commented Aug 8, 2023

I'm thinking here of PEP 257, https://peps.python.org/pep-0257/#one-line-docstrings

@bobturneruk
Copy link
Contributor

Looks like your proposal is the best way to do things in this situation.

@tobyhodges
Copy link
Member

tobyhodges commented Aug 15, 2023

If you can find time to prepare a PR, @deppen8 , I'll be happy to review.

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 a pull request may close this issue.

3 participants