Skip to content

Use strings as values for enum instead of integers#469

Merged
jsmariegaard merged 5 commits intomainfrom
enum
Dec 12, 2024
Merged

Use strings as values for enum instead of integers#469
jsmariegaard merged 5 commits intomainfrom
enum

Conversation

@ecomodeller
Copy link
Copy Markdown
Member

@ecomodeller ecomodeller commented Nov 21, 2024

@ecomodeller
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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