Skip to content
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

Adding Generics to Pyrsistent Classes #282

Merged
merged 2 commits into from
Oct 17, 2023
Merged

Conversation

lukasK9999
Copy link
Contributor

Hi there,

I've created a pull request that adds generics to the Pyrsistent library classes to prevent runtime errors when using them with specific types. This change allows you to, for example, import from pyrsistent import PMap and then use PMap[K, V] without encountering unexpected issues.

Copy link
Owner

@tobgu tobgu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Just one minor question on covariance.

from pyrsistent._plist import plist

T = TypeVar("T")
Copy link
Owner

@tobgu tobgu Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this one not covariant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch :) fixed

@tobgu tobgu merged commit af27cf5 into tobgu:master Oct 17, 2023
4 of 5 checks passed
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.

2 participants