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

Improve Python typing in dsl plugin #489

Merged
merged 1 commit into from
Jun 16, 2023
Merged

Conversation

ratijas
Copy link
Contributor

@ratijas ratijas commented Jun 16, 2023

Thanks to a gentle and encouraging ping at this thread, I decided to take a look at how my old rusty code is doin'.

Needless to say, there's a lot of room for improvements — considering a jump from Python 2.7 at that time to 3.9+ nowadays.

Also, @ilius are you sure those self: "typing.Self" are really worth putting everywhere? I don't feel like they bring much value, and they cost a lot of visual noise. Actually, I've never seen these kind of hints.

@ilius
Copy link
Owner

ilius commented Jun 16, 2023

I don't like adding typing.Self either, but I added them to get rid of errors given by ruff tool which I think is the only fast type checker for Python. I can't imagine running mypy on every commit, it's so slow.

@ilius ilius merged commit eefaf00 into ilius:master Jun 16, 2023
@ilius
Copy link
Owner

ilius commented Jun 16, 2023

Thanks for PR.

If you have time, please take a look at this Go program I wrote:
https://github.com/ilius/repassgen

Specially Go files starting with lex and functions starting with Lex.

I think this is the perfect design for things like template rendering, and might fit perfectly for DSL -> HTML transformation as well (since we don't need to extract the parse tree). It can make the code much nicer and easier to maintain.

@ratijas ratijas deleted the work/ratijas/typing branch June 16, 2023 21:36
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