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

fix optional type hints #117

Merged
merged 1 commit into from
Dec 7, 2022
Merged

fix optional type hints #117

merged 1 commit into from
Dec 7, 2022

Conversation

juanitorduz
Copy link
Collaborator

@juanitorduz juanitorduz commented Dec 6, 2022

hey! this PR just correct some type hints: From the documentation:

You can use the Optional type modifier to define a type variant that allows None, such as Optional[int] (Optional[X] is the preferred shorthand for Union[X, None])

This means that a parameter with a default value is not an Optional type. We will capture these type of errors once we set up mypy.
In addition, we should not use mutable structures as defaults. It is better to set None as default, see https://florimond.dev/en/posts/2018/08/python-mutable-defaults-are-the-source-of-all-evil/

@twiecki twiecki merged commit 66d7fca into main Dec 7, 2022
@twiecki twiecki deleted the fix_optional_type_hints branch December 7, 2022 06:34
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