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

Improved typing of method signatures for critical paras etc. #142

Merged
merged 1 commit into from
Sep 20, 2023

Conversation

cloasdata
Copy link

Hello Caleb,

our linter/typechecker is flagging some signatures from eos mixtures.
Ive updated the the docstring with the correct type.

Any plans to gradefully support python type hints?

Cheers Simon

@CalebBell CalebBell merged commit e2f8e49 into CalebBell:master Sep 20, 2023
13 checks passed
@CalebBell
Copy link
Owner

Hello Simon,
Thank you for these fixes. I appreciate it. Copy/paste is a terrible thing sometimes, or I would have noticed it.

I have only experimented with using MonkeyType to automatically generate type hint .pyi files in fluids & ht: https://github.com/Instagram/MonkeyType/commits/main
In general I greatly enjoy strongly typed languages because types are enforced in them and this allows the compiler to write efficient code, but I have struggled to see the benefit to a project like Thermo in using the type of typing Python offers currently. I am experienced enough to pre-date type hints in Python, and look forward to seeing how they evolve. What is your experience?

Sincerely,
Caleb

@cloasdata
Copy link
Author

So far most of the typing problems are solved in python but still typing seems to be the area of python with the largest movements. And there are still some pitfalls and some stuff is not very explicit for example when try to use generics. Often taking hours to solve without one productive line of code (which always was a major argument for python).

However, dynamic typing resp. the type checker provide a profound way to avoid type errors before import time. This reduces runtime errors based on type problems significantly. Additional typing then is a lot more convent instead of always maintain the types inside docstring or other constructs. At the end it also forces programmers to have good design and architecture instead of leaving everything to the dynamics of python. So at the end it is like python ducktyping a double edged sword but still with possibility to let the programmer deiced which one needs to be sharper.

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