Skip to content

Missing position-only markers for function parameters #95034

Closed as not planned
Closed as not planned

Description

@slateny

There are a number (>10) of modules with functions that don't have the position-only marker (see #91950, #94735), for example here is a (partial) list that contains a number of functions that should likely have position-only markers but are missing from the documentation (can also be verified via inspect.signature).

- [ ] atexit
- [x] audioop (skipped, module to be deprecated in 3.13)
- [ ] binascii
- [ ] cmath
- [ ] codecs
- [ ] csv
- [ ] ctypes
- [ ] curses
- [ ] curses
- [ ] decimal
- [ ] fcntl
- [ ] functools
- [ ] gc
- [ ] heapq
- [ ] hmac
- [ ] itertools
- [ ] keyword
- [ ] locale
- [ ] lzma
- [ ] marshal
- [ ] math
- [ ] operator
- [x] os
- [ ] ossaudiodev
- [ ] pwd
- [ ] pyexpat
- [ ] random
- [ ] readline
- [ ] resource
- [ ] secrets
- [ ] select
- [ ] signal
- [ ] socket
- [ ] spwd
- [ ] ssl
- [ ] stat
- [ ] struct
- [ ] sys
- [ ] syslog
- [ ] termios
- [ ] _thread
- [ ] threading
- [ ] time
- [ ] unicodedata
- [ ] weakref
- [ ] zlib

Activity

  1. slateny commented on Oct 12, 2022

    @slateny
    ContributorAuthor

    As there's quite a number of modules involved I'm wondering how best to structure PRs so it'd be easy to review, and have something like this in mind:

    1. Provide some command to get all modified functions (git diff ...)
    2. Copy-pastable list of functions with keyword arguments that can be run (all functions should raise TypeError) to confirm that the functions are indeed keyword-only, i.e.
    import math
    math.ceil(x=None)
    math.comb(n=None, k=None)
    math.copysign(x=None, y=None)
    math.fabs(x=None)
    

    results in

    >>> math.ceil(x=None)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: math.ceil() takes no keyword arguments
    >>> math.comb(n=None, k=None)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: math.comb() takes no keyword arguments
    >>> math.copysign(x=None, y=None)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: math.copysign() takes no keyword arguments
    >>> math.fabs(x=None)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: math.fabs() takes no keyword arguments
    

    confirming the fact that these functions are missing the position-only marker.

    1. Some diff command that can compare the two lists to confirm they're equivalent

    Any more suggestions to make it easier to review / show correctness?

  2. self-assigned this
    on Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

docsDocumentation in the Doc dir

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions