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

Return tuple from SequenceParser and OptionalParser #116

Open
drhagen opened this issue Nov 2, 2024 · 0 comments
Open

Return tuple from SequenceParser and OptionalParser #116

drhagen opened this issue Nov 2, 2024 · 0 comments
Milestone

Comments

@drhagen
Copy link
Owner

drhagen commented Nov 2, 2024

Right now, SequenceParser and OptionalParser return Python lists. This was originally done because [] is syntactically easier to work with than (). However, these are not really intended to be mutable sequences. This plays badly with typing, which has no concept of "a list of length 2 containing a string followed by an int", but does have tuple[str, int].

This is a breaking change, though not massively so because, at least for me, the outputs are typically splatted in a dataclass, destructured, concatenated with each other, length-checked, sliced, or indexed, all of which will work unchanged with tuples.

@drhagen drhagen modified the milestones: v2, v3 Nov 2, 2024
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

No branches or pull requests

1 participant