Skip to content

Conversation

sobolevn
Copy link
Member

Closes #10657

@sobolevn sobolevn requested a review from srittau September 15, 2023 08:09
@github-actions

This comment has been minimized.

@srittau
Copy link
Collaborator

srittau commented Sep 15, 2023

Hmm, I'm reconsidering this in light of the primer hits and the fact that the docs state things like this:

class codecs.IncrementalEncoder(errors='strict')
Constructor for an IncrementalEncoder instance.

All incremental encoders must provide this constructor interface. They are free to add additional keyword arguments, but only the ones defined here are used by the Python codec registry.

encode
decode
The stateless encoding and decoding functions. These must be functions or methods which have the same interface as the encode() and decode() methods of Codec instances (see Codec Interface). The functions or methods are expected to work in a stateless mode.
incrementalencoder
incrementaldecoder
Incremental encoder and decoder classes or factory functions. These have to provide the interface defined by the base classes IncrementalEncoder and IncrementalDecoder, respectively. Incremental codecs can maintain state.

@srittau
Copy link
Collaborator

srittau commented Sep 15, 2023

At least for the incremental coders. Since normal codecs are seemingly implemented with positional-only args in CPython, using pos-only protocols seems correct and able to catch errors.

@srittau
Copy link
Collaborator

srittau commented Sep 15, 2023

Suggestion: Change the normal codecs, but leave the incremental coders for now and wait what for the discussion in python/cpython#109444.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau srittau merged commit d88205c into main Sep 16, 2023
@srittau srittau deleted the issue-10657 branch September 16, 2023 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename codecs._Encoder, codecs._Decoder, .encode and .decode input argument

2 participants