Skip to content

Conversation

@hugovk
Copy link
Member

@hugovk hugovk commented Dec 21, 2023

Helps #2625.

Adds the from __future__ import annotations to all files, and will ensure it's added for new files too, so we can use newer type annotations for older Pythons.

For example, use list and tuple directly instead of first from typing import List, Tuple.

@radarhere
Copy link
Member

I see you've added it to the test suite as well. I would have thought that the goal of #2625 was to add type hints to user-facing code. Or are you suggesting that expecting that we will eventually use type hints for their own sake?

@hugovk
Copy link
Member Author

hugovk commented Dec 21, 2023

User-facing code is the primary focus, but typing tests can also be beneficial, especially if it helps evaluate how the typed production code is used, and if it helps us find bugs in tests.

See also https://sethmlarson.dev/tests-arent-enough-case-study-after-adding-types-to-urllib3#type-your-tests

@radarhere radarhere merged commit e9453a7 into python-pillow:main Dec 22, 2023
@hugovk hugovk deleted the future-annotations branch December 22, 2023 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants