Skip to content

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

vivekvashist
Copy link
Contributor

@vivekvashist vivekvashist commented Dec 15, 2021

Copy link
Member

@AlexWaygood AlexWaygood left a 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!

vivekvashist and others added 4 commits December 17, 2021 06:41
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>
@vivekvashist
Copy link
Contributor Author

Thanks Alex. I just committed your suggestions - is that ok ?

@AlexWaygood
Copy link
Member

Thanks Alex. I just committed your suggestions - is that ok ?

I would revert the changes to max and min as well — as I said in my comments, I think they are better as they are currently 🙂

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Jan 16, 2022
@erlend-aasland erlend-aasland changed the title bpo-46092: Fix/update missing parameters in function signatures for Built-in Functions documentation gh-90250: Fix/update missing parameters in function signatures for Built-in Functions documentation Feb 9, 2024
@erlend-aasland
Copy link
Contributor

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 / is ok, IMO, though.

@@ -111,15 +111,15 @@ are always available. They are listed here in alphabetical order.
return False


.. function:: ascii(object)
.. function:: ascii(obj, /)
Copy link
Contributor

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.

Suggested change
.. function:: ascii(obj, /)
.. function:: ascii(object, /)

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, what docstring?

Copy link
Contributor

Choose a reason for hiding this comment

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

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).

Copy link
Member

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.

Copy link
Member

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, /)
Copy link
Contributor

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.

Suggested change
.. 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, /)
Copy link
Contributor

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.

Suggested change
.. 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, /)
Copy link
Contributor

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.

Suggested change
.. 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, /)
Copy link
Contributor

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.

Suggested change
.. 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, /)
Copy link
Contributor

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.

Suggested change
.. 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 , /)
Copy link
Contributor

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.

Suggested change
.. function:: issubclass(cls, class_or_tuple , /)
.. function:: issubclass(class, classinfo , /)

Copy link
Member

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):

Suggested change
.. function:: issubclass(cls, class_or_tuple , /)
.. function:: issubclass(cls, class_or_tuple, /)

or

Suggested change
.. 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, /)
Copy link
Contributor

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.

Suggested change
.. 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, /)
Copy link
Contributor

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.

Suggested change
.. function:: reversed(sequence, /)
.. function:: reversed(seq, /)

Copy link
Member

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, /)
Copy link
Contributor

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.

Suggested change
.. function:: setattr(obj, name, value, /)
.. function:: setattr(object, name, value, /)

This reverts commit 6d94bcf.
@erlend-aasland erlend-aasland marked this pull request as draft February 13, 2024 09:22
@erlend-aasland
Copy link
Contributor

Let's close this until we know how to solve these issues on a larger scale; thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DO-NOT-MERGE docs Documentation in the Doc dir skip news stale Stale PR or inactive for long period of time.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants