-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed as not planned
Labels
3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
# The help() output for str.count lacks the '/' for positional-only arguments
help(str.count)
# Relevant output line:
# count(...) unbound builtins.str method
# S.count(sub[, start[, end]]) -> int
# In contrast, str.strip correctly shows the '/' marker
help(str.strip)
# Relevant output line:
# strip(self, chars=None, /) unbound builtins.str method
Description
There is an inconsistency in the signature displayed by the built-in help()
function for str.count
when compared to other similar methods like str.strip
.
While str.count
is functionally a positional-only argument method (it raises a TypeError
if called with keyword arguments), its signature in help()
does not include the /
marker to indicate this. This is inconsistent with other methods that correctly display the positional-only marker.
This can be a minor point of confusion for users learning about Python's function signatures and introspection.
CPython versions tested on:
3.12
Operating systems tested on:
Windows
Metadata
Metadata
Assignees
Labels
3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error