-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Closed
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir
Description
Documentation
The codecs
docs specify the encode/decode functions to be positional or kwargs:
Codec.encode(input, errors='strict')
Codec.decode(input, errors='strict')
This contradicts at least some built-in codecs:
Python 3.11.4 (main, Jun 9 2023, 07:59:55) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import codecs
>>> enc = codecs.getencoder("utf8")
>>> enc(input="abc")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: _codecs.utf_8_encode() takes no keyword arguments
For consistency's sake I suggest to also annotate the incremental en-/decoders to specify positional-only arguments, although they are positional or kwargs at runtime.
Cf. python/typeshed#10657 and python/typeshed#10713.
Linked PRs
Metadata
Metadata
Assignees
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir
Projects
Status
Done