FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-101118: correct function signatures in the math module docs by skirpichev · Pull Request #101120 · python/cpython · GitHub

/ cpython Public

gh-101118: correct function signatures in the math module docs - #101120

Closed
skirpichev wants to merge 1 commit into
python:mainfrom
skirpichev:fix-101118
Closed

gh-101118: correct function signatures in the math module docs#101120
skirpichev wants to merge 1 commit into
python:mainfrom
skirpichev:fix-101118

Conversation

skirpichev commented Jan 18, 2023
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

sobolevn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Right now we haven't decided yet what to do with positional only args in the docs.

Some maintainers add them, some later remove them, some prefer not to touch it.

This is just for the context for this change :)

Copy link
Copy Markdown
Contributor

There was a decision not to add these to the docs because lay readers mostly find them confusing, because it makes the docs harder to read, and there are no known usability issues with the docs as they are now. So exceptions have been made for functions likes sorted() that have a complex signature that users need to know about. In the case of the math module, we don't get users writing sin(x=pi/4) so these edits are just gratuitous.

rhettinger closed this Jan 18, 2023

skirpichev commented Jan 18, 2023
edited
Loading

Copy link
Copy Markdown
Member Author

Well, the inspect module does very clear distinction:

>>> def foo(x): pass  # like e.g. math.ceil shown in docs
... 
>>> def bar(x, /): pass
... 
>>> inspect.signature(foo)
<Signature (x)>
>>> inspect.signature(bar)
<Signature (x, /)>
>>> foo(x=1)
>>> bar(x=1)  # that's how math,ceil behave in the reality
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: bar() got some positional-only arguments passed as keyword arguments: 'x'

So exceptions have been made for functions likes sorted() that have a complex signature

The os module seems to be one using "/". I doubt that the os.setegid has a complex signature.

Sorry for the nitpick, anyway.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL