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

Use strings as values for enum instead of integers #469

Merged
merged 5 commits into from
Dec 12, 2024
Merged

Use strings as values for enum instead of integers #469

merged 5 commits into from
Dec 12, 2024

Conversation

ecomodeller
Copy link
Member

@ecomodeller ecomodeller commented Nov 21, 2024

@ecomodeller
Copy link
Member Author

Turns out you can use strings as the backing values for enums, which makes it trivial to construct given the correct string.

Question is do we still need/want to support the more flexible version?

def from_string(s: str) -> "GeometryType":

@ecomodeller
Copy link
Member Author

Static type checks fails, we need to merge #470 first.

@ecomodeller ecomodeller marked this pull request as ready for review December 12, 2024 13:05
@jsmariegaard jsmariegaard self-requested a review December 12, 2024 13:16
Copy link
Member

@jsmariegaard jsmariegaard left a comment

Choose a reason for hiding this comment

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

Love it!

@jsmariegaard jsmariegaard merged commit 286b974 into main Dec 12, 2024
6 checks passed
@jsmariegaard jsmariegaard deleted the enum branch December 12, 2024 13:35
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