Add useful type hints for possibly a better experience for API users #1344
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, this PR is like a question from me. The only change in it is adding a return type to the
__getitem__
method of thedesc.equilibrium.EquilibriaFamily
class.I started learning DESC, and I thought type hints may make the API a little easier to use.
For example, I wanted to get an equilibrium from the instance of a
EquilibriaFamily
class by using the indexing operator like below:But, since the
__getitem__
method of theEquilibriaFamily
class doesn't have a return type, my IDE doesn't know that the variablean_equilibrium
is an instance ofEquilibrium
. So, I have to tell it myself to see the available methods of theEquilibrium
class, such as thesave
method.Would you be interested if I added useful types like this as I come across them to improve the API experience?