PlasmaPy icon indicating copy to clipboard operation
PlasmaPy copied to clipboard

Directly use `valid_categories` to list particle categories in `is_category` method

Open namurphy opened this issue 3 years ago • 2 comments

Right now the list of particle categories (contained in particle_class.valid_categories) is typed out directly in the docstring for AbstractPhysicalParticle.is_category. The disadvantage of this is that if valid_particles changes, there's a chance that the docstring will become out-of-date. It would be helpful to use the contents of valid_particles to print out the list of categories.

This could possibly be done as an f-string, possibly after creating a separate function outside of the docstring). The formatting should say the same (i.e. double back ticks and double quotes around the categories, with lines limited to ≲72 characters) Since valid_categories is a set, the contents will need to be sorted alphabetically. This could possibly go in the docstring for valid_categories too.

This should be done after both #1720 and #1721 are merged.

namurphy avatar Sep 01 '22 21:09 namurphy

I can try this one 😄!

MKastek avatar Sep 13 '22 20:09 MKastek

@MKastek — please go for it, and thank you!

namurphy avatar Sep 14 '22 14:09 namurphy