Skip to content

remove literal generic type parameters of Can*#487

Merged
jorenham merged 3 commits into
masterfrom
no-literal-generics
Dec 7, 2025
Merged

remove literal generic type parameters of Can*#487
jorenham merged 3 commits into
masterfrom
no-literal-generics

Conversation

@jorenham

@jorenham jorenham commented Dec 7, 2025

Copy link
Copy Markdown
Owner

The following protocols are no longer generic:

  • CanBytes
  • CanStr
  • CanIndex
  • CanRepr
  • CanFormat
  • CanDelattr
  • CanLen
  • CanLengthHint
  • CanBuffer

Additionally, CanGetattr, CanSetattr, and CanSetName had their first generic str-bound type parameter removed, so that now accept a single type arugment.
Similarly, this removes the last type-parameter of the CanContains and CanSequence protocols.

These changes were made because passing Literals as generic type arguments almost never works as intended in practice. One excpetion is CanBool, which has some use-cases, and is therefore left as a generic type.

@jorenham jorenham added this to the v0.15.0 milestone Dec 7, 2025
@jorenham jorenham changed the title remove literal generic type parameters remove literal generic type parameters of Can* Dec 7, 2025
@jorenham

jorenham commented Dec 7, 2025

Copy link
Copy Markdown
Owner Author

This doesn't seem to cause any issues for scipy-stubs, so in it goes

@jorenham jorenham merged commit fa2e560 into master Dec 7, 2025
24 checks passed
@jorenham jorenham deleted the no-literal-generics branch December 7, 2025 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant