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

[python] Don't use TypeVar when defining coordinate types #150

Merged
merged 1 commit into from Mar 3, 2023

Conversation

thetorpedodog
Copy link
Member

My previous change which used TypeVar for coordinate types 1 was actually a Bad Idea. While it was better in that it prohibited heterogeneous collections and slices, it was worse in that made the SparseDFCoord type (and derived types) into generic types, which we do not want.

The right way to avoid repeating all the possible types is to make a union of the possible containers, and then specify that with all the possible contents that may go into those containers.

My previous change which used TypeVar for coordinate types [1] was
actually a Bad Idea.  While it was better in that it prohibited
heterogeneous collections and slices, it was worse in that made the
SparseDFCoord type (and derived types) into generic types, which
we do not want.

The *right* way to avoid repeating all the possible types is to make
a union of the possible *containers*, and then specify *that* with all
the possible contents that may go into those containers.

[1]: #141
@johnkerl johnkerl changed the title Don't use TypeVar when defining coordinate types. Don't use TypeVar when defining coordinate types Mar 3, 2023
@thetorpedodog thetorpedodog merged commit 32f223c into main Mar 3, 2023
@thetorpedodog thetorpedodog deleted the detypevarify branch March 3, 2023 22:11
@johnkerl johnkerl changed the title Don't use TypeVar when defining coordinate types [python] Don't use TypeVar when defining coordinate types Mar 3, 2023
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.

None yet

3 participants