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 typing.Self where applicable #533

Closed
wants to merge 1 commit into from

Conversation

InSyncWithFoo
Copy link
Contributor

Self should be preferred over "ParserElement" since the former is dedicated for exactly this purpose and may, in some cases, provides better insight than a non-discriminating ParserElement.

This change requires typing_extensions as a type-checking time dependency; it should not alter runtime behaviour, unless someone inspects those type hints at runtime.

@ptmcg ptmcg self-assigned this Feb 12, 2024
@ptmcg
Copy link
Member

ptmcg commented Feb 13, 2024

At the moment, pyparsing has no required external run-time dependencies, unless you want to create railroad diagrams, which are typically only a dev-time requirement.

Self will be available from typing in 3.11 without any added dependencies. External dependencies that are version-sensitive are a major chore. I'm open to revisiting this if we get some compelling examples where Self will be significantly better.

@ptmcg ptmcg closed this Feb 13, 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

Successfully merging this pull request may close these issues.

None yet

2 participants