bpo-29956: Fix misleading documentation for math.exp.#951
bpo-29956: Fix misleading documentation for math.exp.#951rhettinger merged 1 commit intopython:masterfrom
Conversation
|
@mdickinson, thanks for your PR! By analyzing the history of the files in this pull request, we identified @birkenfeld, @tiran and @benjaminp to be potential reviewers. |
|
|
||
| Return ``e**x``. | ||
|
|
||
| Return e raised to the power *x*, where e = 2.718281... is the base |
There was a problem hiding this comment.
I think e should be emphasized, like in log(), log1p, etc. Maybe e = 2.718281... should have the code markup.
There was a problem hiding this comment.
Yes, it's not clear. The problem with marking it up is that we get back to the issue where it could be confused with math.e. I decided not to mark it up, to be consistent with the documentation for math.e.
There was a problem hiding this comment.
Do you think math.expm1 needs to be changed too?
There was a problem hiding this comment.
@csabella: Yes! How about
Return e raised to the power x, minus one. For small floats x, the [...]
?
There was a problem hiding this comment.
e = 2.718281... is not a code. I don't think it should have the code markup.
Emphasized *e* is used in descriptions of log() and log1p(). But it also is used in frexp(). I suggest to rename e in frexp() description for avoiding confusion.
There was a problem hiding this comment.
It would be best to use Sphinx's inline math construct here. Is there anything that would prevent using :math: role in Python documentation?
As pointed out in issue 29956,
math.exp(x)is not the same asmath.e**x. This PR attempts to make the documentation a bit less misleading.