Skip to content

Conversation

@alexrudd2
Copy link
Collaborator

Solves another 3 mypy errors.

config_types below seemed like a good candidate for using a TypedDict (~equivalent to a struct)


self.config_types = {
Label.type_bits: {
Label.type: CellType.BITS,
Label.next: None,
Label.value: 0,
Label.action: None,
Label.method: self.handle_type_bits,
},

However, I ran into issues:
(1) mypy doesn't support using variables as TypedDict keys: python/mypy#7178. This unfortunate deficiency means TypedDict is not suitable here until mypy improves.
(2) Using type as a key is messy, since it's a "soft keyword". Maybe it would be better to use kind? This should have a benefit beyond mypy.

:meta private:
"""
check: tuple
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is surely good news, that did not work 1-2 years ago.

Thanks.

@janiversen janiversen merged commit 647b270 into dev Mar 5, 2024
@janiversen janiversen deleted the simulator-types branch March 5, 2024 20:15
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants