Skip to content

Using Types of Members of Generic Containers #1087

Answered by erictraut
hmc-cs-mdrissi asked this question in Q&A
Discussion options

You must be logged in to vote

How about this?

class Processor(Generic[T1, T2]):
    def __init__(self, config: Config[T1, T2]):
        self._config = config

    def process_foo(self) -> list[T1]:
        return list(self._config.foo.values())

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hmc-cs-mdrissi
Comment options

Answer selected by hmc-cs-mdrissi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants