Skip to content

Add type hints to type-specific lists #28

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

Merged
merged 1 commit into from
Nov 14, 2022
Merged

Add type hints to type-specific lists #28

merged 1 commit into from
Nov 14, 2022

Conversation

nathan-hess
Copy link
Owner

@nathan-hess nathan-hess commented Nov 14, 2022

Major Changes and Improvements

  • Set up type hints for pyxx.arrays.TypedList and pyxx.arrays.TypedListWithID

This aids in type-checking:

from pyxx.arrays import TypedList
myList = TypedList(list_type=float)
myList.insert(0, 'newValue')

# Generates Mypy warning:
# Argument 2 to "insert" of "TypedList" has incompatible type "str"; expected "float"

It also allows more useful auto-completion:
image

Notes and References

Set up type hints for `pyxx.arrays.TypedList` and `pyxx.arrays.TypedListWithID`
@nathan-hess nathan-hess added enhancement New feature or request utilities Additions or updates to utility scripts and tools labels Nov 14, 2022
@nathan-hess nathan-hess self-assigned this Nov 14, 2022
@nathan-hess nathan-hess merged commit 4fa0a2f into main Nov 14, 2022
@nathan-hess nathan-hess deleted the type-hints branch November 14, 2022 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request utilities Additions or updates to utility scripts and tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant