-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-90250: Fix/update missing parameters in function signatures for Built-in Functions documentation #30128
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
Conversation
…ctions documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if it is decided that it would be best not to add the forward slashes to the documentation here (as is being discussed in the BPO issue), you've picked up on a number of typos that would be worth correcting. I also think it's good to have consistent parameter names between the output of help()
and the documentation here. So, thank you!
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Thanks Alex. I just committed your suggestions - is that ok ? |
I would revert the changes to |
This PR is stale because it has been open for 30 days with no activity. |
I'm not sure these changes are worth it, as this PR stands. It is nice to align the docs with the docstrings, but in some cases we should rather align the docstrings with the docs (these are mostly functions that take positional-only parameters; we can change the param names if we want). Adding |
@@ -111,15 +111,15 @@ are always available. They are listed here in alphabetical order. | |||
return False | |||
|
|||
|
|||
.. function:: ascii(object) | |||
.. function:: ascii(obj, /) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave the param name untouched and instead consider updating the docstring.
.. function:: ascii(obj, /) | |
.. function:: ascii(object, /) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, what docstring?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 400 to 403 in 5643856
ascii as builtin_ascii | |
obj: object | |
/ |
Perhaps "signature" is more accurate. Anyway, I'm not sure it is worth it (neither this PR nor updating the signature).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok. I am not sure that it is necessary to edit many docstrings here: they are not wrong, as the params do not really have names.
See my comment on the ticket for a broader point about his issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, we should pick the clearer name and use that consistently. In this case, while using the full name rather than abbreviating is potentially a bit clearer on the word intended, the latter avoids confusion on the meaning: object
is already a builtin name, the base type object itself, while obj
seems to be de-facto convention for function parameter that is an arbitrary object instance to act on.
@@ -230,7 +230,7 @@ are always available. They are listed here in alphabetical order. | |||
See also :ref:`binaryseq`, :ref:`typebytes`, and :ref:`bytes-methods`. | |||
|
|||
|
|||
.. function:: callable(object) | |||
.. function:: callable(obj, /) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave the param name untouched and instead consider updating the docstring.
.. function:: callable(obj, /) | |
.. function:: callable(object, /) |
@@ -405,7 +405,7 @@ are always available. They are listed here in alphabetical order. | |||
:meth:`~object.__float__` are not defined. | |||
|
|||
|
|||
.. function:: delattr(object, name) | |||
.. function:: delattr(obj, name, /) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave the param name untouched and instead consider updating the docstring.
.. function:: delattr(obj, name, /) | |
.. function:: delattr(object, name, /) |
@@ -778,15 +778,15 @@ are always available. They are listed here in alphabetical order. | |||
regardless of where the function is called. | |||
|
|||
|
|||
.. function:: hasattr(object, name) | |||
.. function:: hasattr(obj, name, /) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave the param name untouched and instead consider updating the docstring.
.. function:: hasattr(obj, name, /) | |
.. function:: hasattr(object, name, /) |
|
||
The arguments are an object and a string. The result is ``True`` if the | ||
string is the name of one of the object's attributes, ``False`` if not. (This | ||
is implemented by calling ``getattr(object, name)`` and seeing whether it | ||
raises an :exc:`AttributeError` or not.) | ||
|
||
|
||
.. function:: hash(object) | ||
.. function:: hash(obj, /) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave the param name untouched and instead consider updating the docstring.
.. function:: hash(obj, /) | |
.. function:: hash(object, /) |
@@ -948,7 +948,7 @@ are always available. They are listed here in alphabetical order. | |||
See the :ref:`integer string conversion length limitation | |||
<int_max_str_digits>` documentation. | |||
|
|||
.. function:: isinstance(object, classinfo) | |||
.. function:: isinstance(obj, class_or_tuple, /) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave the param name untouched and instead consider updating the docstring.
.. function:: isinstance(obj, class_or_tuple, /) | |
.. function:: isinstance(object, classinfo, /) |
@@ -965,7 +965,7 @@ are always available. They are listed here in alphabetical order. | |||
*classinfo* can be a :ref:`types-union`. | |||
|
|||
|
|||
.. function:: issubclass(class, classinfo) | |||
.. function:: issubclass(cls, class_or_tuple , /) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave the param name untouched and instead consider updating the docstring.
.. function:: issubclass(cls, class_or_tuple , /) | |
.. function:: issubclass(class, classinfo , /) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also a typo (stray space):
.. function:: issubclass(cls, class_or_tuple , /) | |
.. function:: issubclass(cls, class_or_tuple, /) |
or
.. function:: issubclass(cls, class_or_tuple , /) | |
.. function:: issubclass(cls, classinfo, /) |
@@ -1556,7 +1556,7 @@ are always available. They are listed here in alphabetical order. | |||
sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`. | |||
|
|||
|
|||
.. function:: repr(object) | |||
.. function:: repr(obj, /) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave the param name untouched and instead consider updating the docstring.
.. function:: repr(obj, /) | |
.. function:: repr(object, /) |
@@ -1570,7 +1570,7 @@ are always available. They are listed here in alphabetical order. | |||
:exc:`RuntimeError`. | |||
|
|||
|
|||
.. function:: reversed(seq) | |||
.. function:: reversed(sequence, /) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave the param name untouched and instead consider updating the docstring.
.. function:: reversed(sequence, /) | |
.. function:: reversed(seq, /) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case at least ISTM sequence
reads clearer than seq
; beginners and particularly non-native speakers may not immediately assume seq
is short for sequence
.
@@ -1619,7 +1619,7 @@ are always available. They are listed here in alphabetical order. | |||
module. | |||
|
|||
|
|||
.. function:: setattr(object, name, value) | |||
.. function:: setattr(obj, name, value, /) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave the param name untouched and instead consider updating the docstring.
.. function:: setattr(obj, name, value, /) | |
.. function:: setattr(object, name, value, /) |
This reverts commit 6d94bcf.
Let's close this until we know how to solve these issues on a larger scale; thanks for the PR! |
https://bugs.python.org/issue46092