cpython icon indicating copy to clipboard operation
cpython copied to clipboard

Doc: Add a single table as summary to math documentation

Open Nodd opened this issue 1 year ago โ€ข 5 comments

This is an draft for a table summary for the math module, as discussed in discourse. This is the version with a single table, with intermediate headers.

Direct link to the page preview

There is an alternative with multiple tables


๐Ÿ“š Documentation preview ๐Ÿ“š: https://cpython-previews--125810.org.readthedocs.build/

Nodd avatar Oct 21 '24 20:10 Nodd

Thanks for doing this, and linking directly to the preview.

I think the summary would be a little better if the arguments were shown, especially since sometimes a value mentioned in the summary is an argument, and sometimes a constant:

  • exp(x): e raised to the power of x
  • pow(x, y): x raised to the power of y

nedbat avatar Oct 22 '24 12:10 nedbat

I thought about that too, and I even started to implement it. It looks indeed better, but it has to be done manually, so it's a bit tedious. If someone knows a better way than this:

:func:`pow(x, y) <pow>`

I'm all ears!

Nodd avatar Oct 22 '24 12:10 Nodd

The parens are added by a sphinx setting (wrongly, I always thought, as func() is not the same as func or func(a, b) โ€“ with marked-up doc we donโ€™t need the parens to signify that this is a function), so maybe there is another setting to show signatures? Then again maybe not, as signatures can be quite heavy with annotationsโ€ฆ

merwok avatar Oct 22 '24 14:10 merwok

I added the arguments. I choose to not mark default, positional-only nor keyword-only arguments in the table to keep it as light as possible.

Nodd avatar Oct 22 '24 23:10 Nodd

๐Ÿ‘

I like single table much more. For me, multiple tables take more time to focus and find what I need.

FYI, There is an open PR for string methods: https://github.com/python/cpython/pull/1709

dg-pb avatar Oct 23 '24 00:10 dg-pb

Thanks @willingc, I wasn't sure where was the best to ask for review. I'll keep it in mind for next time.

Nodd avatar Oct 31 '24 23:10 Nodd

@picnixz, see also https://github.com/python/cpython/pull/125810#discussion_r1814366833

skirpichev avatar Nov 01 '24 02:11 skirpichev

Folks, I'm merging this as is. Future PRs can iterate on sections and wording. Thanks!

willingc avatar Nov 01 '24 19:11 willingc

Thanks @Nodd for the PR, and @willingc for merging it ๐ŸŒฎ๐ŸŽ‰.. I'm working now to backport this PR to: 3.12, 3.13. ๐Ÿ๐Ÿ’โ›๐Ÿค–

miss-islington-app[bot] avatar Nov 01 '24 19:11 miss-islington-app[bot]

GH-126308 is a backport of this pull request to the 3.13 branch.

bedevere-app[bot] avatar Nov 01 '24 19:11 bedevere-app[bot]

GH-126309 is a backport of this pull request to the 3.12 branch.

bedevere-app[bot] avatar Nov 01 '24 19:11 bedevere-app[bot]