Skip to content

Missing position-only markers for function parameters #95034

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

Closed
slateny opened this issue Jul 20, 2022 · 1 comment
Closed

Missing position-only markers for function parameters #95034

slateny opened this issue Jul 20, 2022 · 1 comment
Assignees
Labels
docs Documentation in the Doc dir

Comments

@slateny
Copy link
Contributor

slateny commented Jul 20, 2022

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
@slateny slateny added the docs Documentation in the Doc dir label Jul 20, 2022
@slateny
Copy link
Contributor Author

slateny commented Oct 12, 2022

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?

@slateny slateny self-assigned this Oct 12, 2022
@slateny slateny closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

1 participant